diff --git a/deps/EXPAT/expat/CMakeLists.txt b/deps/EXPAT/expat/CMakeLists.txt index fa54c098f..585a678b8 100644 --- a/deps/EXPAT/expat/CMakeLists.txt +++ b/deps/EXPAT/expat/CMakeLists.txt @@ -2,6 +2,65 @@ cmake_minimum_required(VERSION 3.0) project(EXPAT) +include(${CMAKE_CURRENT_LIST_DIR}/ConfigureChecks.cmake) + +macro(expat_shy_set var default cache type desc) + # Macro expat_shy_set came into life because: + # - Expat was previously using an inconsistent mix of CMake's native set() + # and option() to define public build time options. + # - option() is more friendly than set() with regard to configuring an + # external project that is pulled in by means of add_subdirectory() -- + # see comments in issue #597 -- so we wanted to get away from set(). + # - option() auto-converts non-bool values to bool when writing to the CMake + # cache, so we needed something that supports non-bool better and hence + # wanted to get away from plain option(), too. + # + # As a result, this function serves as a hybrid between CMake's regular set() + # and option(): from set() it takes support for non-bool types and the function + # name and signature whereas from option() (with policy CMP0077 mode NEW) it + # takes being shy when a value has previously been defined for that variable. + # + # So that resolves all need for set(.. FORCE) when pulling in Expat by means of + # add_subdirectory(). + # + if(NOT ${cache} STREQUAL "CACHE") + message(SEND_ERROR "Macro usage is: expat_shy_set(var default CACHE type desc)") + endif() + + if(DEFINED ${var}) + # NOTE: The idea is to (ideally) only add to the cache if + # there is no cache entry, yet. "if(DEFINED CACHE{var})" + # requires CMake >=3.14. + if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.14" AND NOT DEFINED "CACHE{${var}}") + set("${var}" "${${var}}" CACHE "${type}" "${desc}") + endif() + else() + set("${var}" "${default}" CACHE "${type}" "${desc}") + endif() +endmacro() + +if(NOT WIN32) + expat_shy_set(EXPAT_WITH_GETRANDOM "AUTO" CACHE STRING "Make use of getrandom function (ON|OFF|AUTO) [default=AUTO]") + expat_shy_set(EXPAT_WITH_SYS_GETRANDOM "AUTO" CACHE STRING "Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO]") +endif() + +macro(evaluate_detection_results use_ref have_ref thing_lower thing_title) + if(${use_ref} AND NOT (${use_ref} STREQUAL "AUTO") AND NOT ${have_ref}) + message(SEND_ERROR + "Use of ${thing_lower} was enforced by ${use_ref}=ON but it could not be found.") + elseif(NOT ${use_ref} AND ${have_ref}) + message("${thing_title} was found but it will not be used due to ${use_ref}=OFF.") + set(${have_ref} 0) + endif() +endmacro() + +if(NOT WIN32) + evaluate_detection_results(EXPAT_WITH_GETRANDOM HAVE_GETRANDOM "function getrandom" "Function getrandom") + evaluate_detection_results(EXPAT_WITH_SYS_GETRANDOM HAVE_SYSCALL_GETRANDOM "syscall SYS_getrandom" "Syscall SYS_getrandom") +endif() + +configure_file(expat_configure.h.cmake "${CMAKE_CURRENT_BINARY_DIR}/expat_configure.h") + if (BUILD_SHARED_LIBS AND MSVC) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() @@ -12,7 +71,7 @@ add_library(expat xmltok.c ) -target_include_directories(expat PRIVATE ${PROJECT_SOURCE_DIR}) +target_include_directories(expat PRIVATE ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) include(GNUInstallDirs) diff --git a/deps/EXPAT/expat/COPYING b/deps/EXPAT/expat/COPYING index 092c83bae..ce9e59392 100644 --- a/deps/EXPAT/expat/COPYING +++ b/deps/EXPAT/expat/COPYING @@ -1,5 +1,5 @@ Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper -Copyright (c) 2001-2016 Expat maintainers +Copyright (c) 2001-2022 Expat maintainers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/deps/EXPAT/expat/ConfigureChecks.cmake b/deps/EXPAT/expat/ConfigureChecks.cmake new file mode 100644 index 000000000..638f0aa28 --- /dev/null +++ b/deps/EXPAT/expat/ConfigureChecks.cmake @@ -0,0 +1,69 @@ +include(CheckCCompilerFlag) +include(CheckCSourceCompiles) +include(CheckIncludeFile) +include(CheckIncludeFiles) +include(CheckLibraryExists) +include(CheckSymbolExists) +include(TestBigEndian) + +check_include_file("dlfcn.h" HAVE_DLFCN_H) +check_include_file("fcntl.h" HAVE_FCNTL_H) +check_include_file("inttypes.h" HAVE_INTTYPES_H) +check_include_file("memory.h" HAVE_MEMORY_H) +check_include_file("stdint.h" HAVE_STDINT_H) +check_include_file("stdlib.h" HAVE_STDLIB_H) +check_include_file("strings.h" HAVE_STRINGS_H) +check_include_file("string.h" HAVE_STRING_H) +check_include_file("sys/stat.h" HAVE_SYS_STAT_H) +check_include_file("sys/types.h" HAVE_SYS_TYPES_H) +check_include_file("unistd.h" HAVE_UNISTD_H) + +check_symbol_exists("getpagesize" "unistd.h" HAVE_GETPAGESIZE) +check_symbol_exists("mmap" "sys/mman.h" HAVE_MMAP) +check_symbol_exists("getrandom" "sys/random.h" HAVE_GETRANDOM) + +if(EXPAT_WITH_LIBBSD) + set(CMAKE_REQUIRED_LIBRARIES "${LIB_BSD}") + set(_bsd "bsd/") +else() + set(_bsd "") +endif() +check_symbol_exists("arc4random_buf" "${_bsd}stdlib.h" HAVE_ARC4RANDOM_BUF) +if(NOT HAVE_ARC4RANDOM_BUF) + check_symbol_exists("arc4random" "${_bsd}stdlib.h" HAVE_ARC4RANDOM) +endif() +set(CMAKE_REQUIRED_LIBRARIES) + +#/* Define to 1 if you have the ANSI C header files. */ +check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) + +test_big_endian(WORDS_BIGENDIAN) +#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ +if(WORDS_BIGENDIAN) + set(BYTEORDER 4321) +else(WORDS_BIGENDIAN) + set(BYTEORDER 1234) +endif(WORDS_BIGENDIAN) + +if(HAVE_SYS_TYPES_H) + check_symbol_exists("off_t" "sys/types.h" OFF_T) + check_symbol_exists("size_t" "sys/types.h" SIZE_T) +else(HAVE_SYS_TYPES_H) + set(OFF_T "long") + set(SIZE_T "unsigned") +endif(HAVE_SYS_TYPES_H) + +check_c_source_compiles(" + #include /* for NULL */ + #include /* for syscall */ + #include /* for SYS_getrandom */ + int main() { + syscall(SYS_getrandom, NULL, 0, 0); + return 0; + }" + HAVE_SYSCALL_GETRANDOM) + +check_c_compiler_flag("-fno-strict-aliasing" FLAG_NO_STRICT_ALIASING) +check_c_compiler_flag("-fvisibility=hidden" FLAG_VISIBILITY) + +check_library_exists(m cos "" _EXPAT_LIBM_FOUND) diff --git a/deps/EXPAT/expat/README b/deps/EXPAT/expat/README deleted file mode 100644 index 40873a6f8..000000000 --- a/deps/EXPAT/expat/README +++ /dev/null @@ -1,146 +0,0 @@ -Expat, Release 2.2.0, stripped and modified for inclusion into Slic3r. -Only the library sources needed for static linking were left. - -The original README follows: ---------------------------------------------------------------------- - - - - Expat, Release 2.2.0 - -This is Expat, a C library for parsing XML, written by James Clark. -Expat is a stream-oriented XML parser. This means that you register -handlers with the parser before starting the parse. These handlers -are called when the parser discovers the associated structures in the -document being parsed. A start tag is an example of the kind of -structures for which you may register handlers. - -Windows users should use the expat_win32bin package, which includes -both precompiled libraries and executables, and source code for -developers. - -Expat is free software. You may copy, distribute, and modify it under -the terms of the License contained in the file COPYING distributed -with this package. This license is the same as the MIT/X Consortium -license. - -Versions of Expat that have an odd minor version (the middle number in -the release above), are development releases and should be considered -as beta software. Releases with even minor version numbers are -intended to be production grade software. - -If you are building Expat from a check-out from the CVS repository, -you need to run a script that generates the configure script using the -GNU autoconf and libtool tools. To do this, you need to have -autoconf 2.58 or newer. Run the script like this: - - ./buildconf.sh - -Once this has been done, follow the same instructions as for building -from a source distribution. - -To build Expat from a source distribution, you first run the -configuration shell script in the top level distribution directory: - - ./configure - -There are many options which you may provide to configure (which you -can discover by running configure with the --help option). But the -one of most interest is the one that sets the installation directory. -By default, the configure script will set things up to install -libexpat into /usr/local/lib, expat.h into /usr/local/include, and -xmlwf into /usr/local/bin. If, for example, you'd prefer to install -into /home/me/mystuff/lib, /home/me/mystuff/include, and -/home/me/mystuff/bin, you can tell configure about that with: - - ./configure --prefix=/home/me/mystuff - -Another interesting option is to enable 64-bit integer support for -line and column numbers and the over-all byte index: - - ./configure CPPFLAGS=-DXML_LARGE_SIZE - -However, such a modification would be a breaking change to the ABI -and is therefore not recommended for general use - e.g. as part of -a Linux distribution - but rather for builds with special requirements. - -After running the configure script, the "make" command will build -things and "make install" will install things into their proper -location. Have a look at the "Makefile" to learn about additional -"make" options. Note that you need to have write permission into -the directories into which things will be installed. - -If you are interested in building Expat to provide document -information in UTF-16 encoding rather than the default UTF-8, follow -these instructions (after having run "make distclean"): - - 1. For UTF-16 output as unsigned short (and version/error - strings as char), run: - - ./configure CPPFLAGS=-DXML_UNICODE - - For UTF-16 output as wchar_t (incl. version/error strings), - run: - - ./configure CFLAGS="-g -O2 -fshort-wchar" \ - CPPFLAGS=-DXML_UNICODE_WCHAR_T - - 2. Edit the MakeFile, changing: - - LIBRARY = libexpat.la - - to: - - LIBRARY = libexpatw.la - - (Note the additional "w" in the library name.) - - 3. Run "make buildlib" (which builds the library only). - Or, to save step 2, run "make buildlib LIBRARY=libexpatw.la". - - 4. Run "make installlib" (which installs the library only). - Or, if step 2 was omitted, run "make installlib LIBRARY=libexpatw.la". - -Using DESTDIR or INSTALL_ROOT is enabled, with INSTALL_ROOT being the default -value for DESTDIR, and the rest of the make file using only DESTDIR. -It works as follows: - $ make install DESTDIR=/path/to/image -overrides the in-makefile set DESTDIR, while both - $ INSTALL_ROOT=/path/to/image make install - $ make install INSTALL_ROOT=/path/to/image -use DESTDIR=$(INSTALL_ROOT), even if DESTDIR eventually is defined in the -environment, because variable-setting priority is -1) commandline -2) in-makefile -3) environment - -Note: This only applies to the Expat library itself, building UTF-16 versions -of xmlwf and the tests is currently not supported. - -Note for Solaris users: The "ar" command is usually located in -"/usr/ccs/bin", which is not in the default PATH. You will need to -add this to your path for the "make" command, and probably also switch -to GNU make (the "make" found in /usr/ccs/bin does not seem to work -properly -- apparently it does not understand .PHONY directives). If -you're using ksh or bash, use this command to build: - - PATH=/usr/ccs/bin:$PATH make - -When using Expat with a project using autoconf for configuration, you -can use the probing macro in conftools/expat.m4 to determine how to -include Expat. See the comments at the top of that file for more -information. - -A reference manual is available in the file doc/reference.html in this -distribution. - -The homepage for this project is http://www.libexpat.org/. There -are links there to connect you to the bug reports page. If you need -to report a bug when you don't have access to a browser, you may also -send a bug report by email to expat-bugs@mail.libexpat.org. - -Discussion related to the direction of future expat development takes -place on expat-discuss@mail.libexpat.org. Archives of this list and -other Expat-related lists may be found at: - - http://mail.libexpat.org/mailman/listinfo/ diff --git a/deps/EXPAT/expat/README.md b/deps/EXPAT/expat/README.md new file mode 100644 index 000000000..72e46a5af --- /dev/null +++ b/deps/EXPAT/expat/README.md @@ -0,0 +1,274 @@ +Expat, Release 2.5.0, only picked the lib related files into Bambu Studio, built as static library + +The original README: +--------------------------------------------------------------------- + +[![Run Linux Travis CI tasks](https://github.com/libexpat/libexpat/actions/workflows/linux.yml/badge.svg)](https://github.com/libexpat/libexpat/actions/workflows/linux.yml) +[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/libexpat/libexpat?svg=true)](https://ci.appveyor.com/project/libexpat/libexpat) +[![Packaging status](https://repology.org/badge/tiny-repos/expat.svg)](https://repology.org/metapackage/expat/versions) +[![Downloads SourceForge](https://img.shields.io/sourceforge/dt/expat?label=Downloads%20SourceForge)](https://sourceforge.net/projects/expat/files/) +[![Downloads GitHub](https://img.shields.io/github/downloads/libexpat/libexpat/total?label=Downloads%20GitHub)](https://github.com/libexpat/libexpat/releases) + + +# Expat, Release 2.5.0 + +This is Expat, a C library for parsing XML, started by +[James Clark](https://en.wikipedia.org/wiki/James_Clark_%28programmer%29) in 1997. +Expat is a stream-oriented XML parser. This means that you register +handlers with the parser before starting the parse. These handlers +are called when the parser discovers the associated structures in the +document being parsed. A start tag is an example of the kind of +structures for which you may register handlers. + +Expat supports the following compilers: + +- GNU GCC >=4.5 +- LLVM Clang >=3.5 +- Microsoft Visual Studio >=15.0/2017 (rolling `${today} minus 5 years`) + +Windows users can use the +[`expat-win32bin-*.*.*.{exe,zip}` download](https://github.com/libexpat/libexpat/releases), +which includes both pre-compiled libraries and executables, and source code for +developers. + +Expat is [free software](https://www.gnu.org/philosophy/free-sw.en.html). +You may copy, distribute, and modify it under the terms of the License +contained in the file +[`COPYING`](https://github.com/libexpat/libexpat/blob/master/expat/COPYING) +distributed with this package. +This license is the same as the MIT/X Consortium license. + + +## Using libexpat in your CMake-Based Project + +There are two ways of using libexpat with CMake: + +### a) Module Mode + +This approach leverages CMake's own [module `FindEXPAT`](https://cmake.org/cmake/help/latest/module/FindEXPAT.html). + +Notice the *uppercase* `EXPAT` in the following example: + +```cmake +cmake_minimum_required(VERSION 3.0) # or 3.10, see below + +project(hello VERSION 1.0.0) + +find_package(EXPAT 2.2.8 MODULE REQUIRED) + +add_executable(hello + hello.c +) + +# a) for CMake >=3.10 (see CMake's FindEXPAT docs) +target_link_libraries(hello PUBLIC EXPAT::EXPAT) + +# b) for CMake >=3.0 +target_include_directories(hello PRIVATE ${EXPAT_INCLUDE_DIRS}) +target_link_libraries(hello PUBLIC ${EXPAT_LIBRARIES}) +``` + +### b) Config Mode + +This approach requires files from… + +- libexpat >=2.2.8 where packaging uses the CMake build system +or +- libexpat >=2.3.0 where packaging uses the GNU Autotools build system + on Linux +or +- libexpat >=2.4.0 where packaging uses the GNU Autotools build system + on macOS or MinGW. + +Notice the *lowercase* `expat` in the following example: + +```cmake +cmake_minimum_required(VERSION 3.0) + +project(hello VERSION 1.0.0) + +find_package(expat 2.2.8 CONFIG REQUIRED char dtd ns) + +add_executable(hello + hello.c +) + +target_link_libraries(hello PUBLIC expat::expat) +``` + + +## Building from a Git Clone + +If you are building Expat from a check-out from the +[Git repository](https://github.com/libexpat/libexpat/), +you need to run a script that generates the configure script using the +GNU autoconf and libtool tools. To do this, you need to have +autoconf 2.58 or newer. Run the script like this: + +```console +./buildconf.sh +``` + +Once this has been done, follow the same instructions as for building +from a source distribution. + + +## Building from a Source Distribution + +### a) Building with the configure script (i.e. GNU Autotools) + +To build Expat from a source distribution, you first run the +configuration shell script in the top level distribution directory: + +```console +./configure +``` + +There are many options which you may provide to configure (which you +can discover by running configure with the `--help` option). But the +one of most interest is the one that sets the installation directory. +By default, the configure script will set things up to install +libexpat into `/usr/local/lib`, `expat.h` into `/usr/local/include`, and +`xmlwf` into `/usr/local/bin`. If, for example, you'd prefer to install +into `/home/me/mystuff/lib`, `/home/me/mystuff/include`, and +`/home/me/mystuff/bin`, you can tell `configure` about that with: + +```console +./configure --prefix=/home/me/mystuff +``` + +Another interesting option is to enable 64-bit integer support for +line and column numbers and the over-all byte index: + +```console +./configure CPPFLAGS=-DXML_LARGE_SIZE +``` + +However, such a modification would be a breaking change to the ABI +and is therefore not recommended for general use — e.g. as part of +a Linux distribution — but rather for builds with special requirements. + +After running the configure script, the `make` command will build +things and `make install` will install things into their proper +location. Have a look at the `Makefile` to learn about additional +`make` options. Note that you need to have write permission into +the directories into which things will be installed. + +If you are interested in building Expat to provide document +information in UTF-16 encoding rather than the default UTF-8, follow +these instructions (after having run `make distclean`). +Please note that we configure with `--without-xmlwf` as xmlwf does not +support this mode of compilation (yet): + +1. Mass-patch `Makefile.am` files to use `libexpatw.la` for a library name: +
+ `find -name Makefile.am -exec sed + -e 's,libexpat\.la,libexpatw.la,' + -e 's,libexpat_la,libexpatw_la,' + -i {} +` + +1. Run `automake` to re-write `Makefile.in` files:
+ `automake` + +1. For UTF-16 output as unsigned short (and version/error strings as char), + run:
+ `./configure CPPFLAGS=-DXML_UNICODE --without-xmlwf`
+ For UTF-16 output as `wchar_t` (incl. version/error strings), run:
+ `./configure CFLAGS="-g -O2 -fshort-wchar" CPPFLAGS=-DXML_UNICODE_WCHAR_T + --without-xmlwf` +
Note: The latter requires libc compiled with `-fshort-wchar`, as well. + +1. Run `make` (which excludes xmlwf). + +1. Run `make install` (again, excludes xmlwf). + +Using `DESTDIR` is supported. It works as follows: + +```console +make install DESTDIR=/path/to/image +``` + +overrides the in-makefile set `DESTDIR`, because variable-setting priority is + +1. commandline +1. in-makefile +1. environment + +Note: This only applies to the Expat library itself, building UTF-16 versions +of xmlwf and the tests is currently not supported. + +When using Expat with a project using autoconf for configuration, you +can use the probing macro in `conftools/expat.m4` to determine how to +include Expat. See the comments at the top of that file for more +information. + +A reference manual is available in the file `doc/reference.html` in this +distribution. + + +### b) Building with CMake + +The CMake build system is still *experimental* and may replace the primary +build system based on GNU Autotools at some point when it is ready. + + +#### Available Options + +For an idea of the available (non-advanced) options for building with CMake: + +```console +# rm -f CMakeCache.txt ; cmake -D_EXPAT_HELP=ON -LH . | grep -B1 ':.*=' | sed 's,^--$,,' +// Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ... +CMAKE_BUILD_TYPE:STRING= + +// Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +// Path to a program. +DOCBOOK_TO_MAN:FILEPATH=/usr/bin/docbook2x-man + +// Build man page for xmlwf +EXPAT_BUILD_DOCS:BOOL=ON + +// Build the examples for expat library +EXPAT_BUILD_EXAMPLES:BOOL=ON + +// Build fuzzers for the expat library +EXPAT_BUILD_FUZZERS:BOOL=OFF + +// Build pkg-config file +EXPAT_BUILD_PKGCONFIG:BOOL=ON + +// Build the tests for expat library +EXPAT_BUILD_TESTS:BOOL=ON + +// Build the xmlwf tool for expat library +EXPAT_BUILD_TOOLS:BOOL=ON + +// Character type to use (char|ushort|wchar_t) [default=char] +EXPAT_CHAR_TYPE:STRING=char + +// Install expat files in cmake install target +EXPAT_ENABLE_INSTALL:BOOL=ON + +// Use /MT flag (static CRT) when compiling in MSVC +EXPAT_MSVC_STATIC_CRT:BOOL=OFF + +// Build fuzzers via ossfuzz for the expat library +EXPAT_OSSFUZZ_BUILD:BOOL=OFF + +// Build a shared expat library +EXPAT_SHARED_LIBS:BOOL=ON + +// Treat all compiler warnings as errors +EXPAT_WARNINGS_AS_ERRORS:BOOL=OFF + +// Make use of getrandom function (ON|OFF|AUTO) [default=AUTO] +EXPAT_WITH_GETRANDOM:STRING=AUTO + +// Utilize libbsd (for arc4random_buf) +EXPAT_WITH_LIBBSD:BOOL=OFF + +// Make use of syscall SYS_getrandom (ON|OFF|AUTO) [default=AUTO] +EXPAT_WITH_SYS_GETRANDOM:STRING=AUTO +``` diff --git a/deps/EXPAT/expat/ascii.h b/deps/EXPAT/expat/ascii.h index d10530b09..1f594d2e5 100644 --- a/deps/EXPAT/expat/ascii.h +++ b/deps/EXPAT/expat/ascii.h @@ -1,5 +1,36 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1999-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2007 Karl Waclawek + Copyright (c) 2017 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define ASCII_A 0x41 diff --git a/deps/EXPAT/expat/asciitab.h b/deps/EXPAT/expat/asciitab.h index 79a15c28c..af766fb24 100644 --- a/deps/EXPAT/expat/asciitab.h +++ b/deps/EXPAT/expat/asciitab.h @@ -1,36 +1,66 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2017 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, + /* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, + /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, + /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, + /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, + /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, + /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, + /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, + /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, + /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, + /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, + /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, + /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, + /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, + /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, + /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, + /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, + /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/deps/EXPAT/expat/config.cmake.in b/deps/EXPAT/expat/config.cmake.in index 8edb5bbbd..42c0116b1 100644 --- a/deps/EXPAT/expat/config.cmake.in +++ b/deps/EXPAT/expat/config.cmake.in @@ -1,4 +1,4 @@ -include(${CMAKE_CURRENT_LIST_DIR}/EXPATTargets.cmake) -set(EXPAT_LIBRARIES EXPAT::expat) -set(EXPAT_INCLUDE_DIRS ${_IMPORT_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) - +include(${CMAKE_CURRENT_LIST_DIR}/EXPATTargets.cmake) +set(EXPAT_LIBRARIES EXPAT::expat) +set(EXPAT_INCLUDE_DIRS ${_IMPORT_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + diff --git a/deps/EXPAT/expat/expat.h b/deps/EXPAT/expat/expat.h index 086e24b39..1c83563cb 100644 --- a/deps/EXPAT/expat/expat.h +++ b/deps/EXPAT/expat/expat.h @@ -1,19 +1,46 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2000-2005 Fred L. Drake, Jr. + Copyright (c) 2001-2002 Greg Stein + Copyright (c) 2002-2016 Karl Waclawek + Copyright (c) 2016-2022 Sebastian Pipping + Copyright (c) 2016 Cristian Rodríguez + Copyright (c) 2016 Thomas Beutlich + Copyright (c) 2017 Rhodri James + Copyright (c) 2022 Thijs Schreijer + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_INCLUDED #define Expat_INCLUDED 1 -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler -#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler -#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler -#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg -#endif - #include #include "expat_external.h" @@ -24,10 +51,9 @@ extern "C" { struct XML_ParserStruct; typedef struct XML_ParserStruct *XML_Parser; -/* Should this be defined using stdbool.h when C99 is available? */ typedef unsigned char XML_Bool; -#define XML_TRUE ((XML_Bool) 1) -#define XML_FALSE ((XML_Bool) 0) +#define XML_TRUE ((XML_Bool)1) +#define XML_FALSE ((XML_Bool)0) /* The XML_Status enum gives the possible return values for several API functions. The preprocessor #defines are included so this @@ -95,7 +121,13 @@ enum XML_Error { /* Added in 2.0. */ XML_ERROR_RESERVED_PREFIX_XML, XML_ERROR_RESERVED_PREFIX_XMLNS, - XML_ERROR_RESERVED_NAMESPACE_URI + XML_ERROR_RESERVED_NAMESPACE_URI, + /* Added in 2.2.1. */ + XML_ERROR_INVALID_ARGUMENT, + /* Added in 2.3.0. */ + XML_ERROR_NO_BUFFER, + /* Added in 2.4.0. */ + XML_ERROR_AMPLIFICATION_LIMIT_BREACH }; enum XML_Content_Type { @@ -135,25 +167,25 @@ enum XML_Content_Quant { typedef struct XML_cp XML_Content; struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - XML_Char * name; - unsigned int numchildren; - XML_Content * children; + enum XML_Content_Type type; + enum XML_Content_Quant quant; + XML_Char *name; + unsigned int numchildren; + XML_Content *children; }; - /* This is called for an element declaration. See above for - description of the model argument. It's the caller's responsibility - to free model when finished with it. + description of the model argument. It's the user code's responsibility + to free model when finished with it. See XML_FreeContentModel. + There is no need to free the model from the handler, it can be kept + around and freed at a later stage. */ -typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); +typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData, + const XML_Char *name, + XML_Content *model); XMLPARSEAPI(void) -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); +XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl); /* The Attlist declaration handler is called for *each* attribute. So a single Attlist declaration with multiple attributes declared will @@ -163,17 +195,12 @@ XML_SetElementDeclHandler(XML_Parser parser, value will be NULL in the case of "#REQUIRED". If "isrequired" is true and default is non-NULL, then this is a "#FIXED" default. */ -typedef void (XMLCALL *XML_AttlistDeclHandler) ( - void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); +typedef void(XMLCALL *XML_AttlistDeclHandler)( + void *userData, const XML_Char *elname, const XML_Char *attname, + const XML_Char *att_type, const XML_Char *dflt, int isrequired); XMLPARSEAPI(void) -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); +XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl); /* The XML declaration handler is called for *both* XML declarations and text declarations. The way to distinguish is that the version @@ -183,15 +210,13 @@ XML_SetAttlistDeclHandler(XML_Parser parser, was no standalone parameter in the declaration, that it was given as no, or that it was given as yes. */ -typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); +typedef void(XMLCALL *XML_XmlDeclHandler)(void *userData, + const XML_Char *version, + const XML_Char *encoding, + int standalone); XMLPARSEAPI(void) -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); - +XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler xmldecl); typedef struct { void *(*malloc_fcn)(size_t size); @@ -215,11 +240,21 @@ XML_ParserCreate(const XML_Char *encoding); and the local part will be concatenated without any separator. It is a programming error to use the separator '\0' with namespace triplets (see XML_SetReturnNSTriplet). + If a namespace separator is chosen that can be part of a URI or + part of an XML name, splitting an expanded name back into its + 1, 2 or 3 original parts on application level in the element handler + may end up vulnerable, so these are advised against; sane choices for + a namespace separator are e.g. '\n' (line feed) and '|' (pipe). + + Note that Expat does not validate namespace URIs (beyond encoding) + against RFC 3986 today (and is not required to do so with regard to + the XML 1.0 namespaces specification) but it may start doing that + in future releases. Before that, an application using Expat must + be ready to receive namespace URIs containing non-URI characters. */ XMLPARSEAPI(XML_Parser) XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); - /* Constructs a new parser using the memory management suite referred to by memsuite. If memsuite is NULL, then use the standard library memory suite. If namespaceSeparator is non-NULL it creates a parser with @@ -235,7 +270,7 @@ XML_ParserCreate_MM(const XML_Char *encoding, const XML_Char *namespaceSeparator); /* Prepare a parser object to be re-used. This is particularly - valuable when memory allocation overhead is disproportionatly high, + valuable when memory allocation overhead is disproportionately high, such as when a large number of small documnents need to be parsed. All handlers are cleared from the parser, except for the unknownEncodingHandler. The parser's external state is re-initialized @@ -249,31 +284,27 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encoding); /* atts is array of name/value pairs, terminated by 0; names and values are 0 terminated. */ -typedef void (XMLCALL *XML_StartElementHandler) (void *userData, - const XML_Char *name, - const XML_Char **atts); - -typedef void (XMLCALL *XML_EndElementHandler) (void *userData, - const XML_Char *name); +typedef void(XMLCALL *XML_StartElementHandler)(void *userData, + const XML_Char *name, + const XML_Char **atts); +typedef void(XMLCALL *XML_EndElementHandler)(void *userData, + const XML_Char *name); /* s is not 0 terminated. */ -typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, - const XML_Char *s, - int len); +typedef void(XMLCALL *XML_CharacterDataHandler)(void *userData, + const XML_Char *s, int len); /* target and data are 0 terminated */ -typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( - void *userData, - const XML_Char *target, - const XML_Char *data); +typedef void(XMLCALL *XML_ProcessingInstructionHandler)(void *userData, + const XML_Char *target, + const XML_Char *data); /* data is 0 terminated */ -typedef void (XMLCALL *XML_CommentHandler) (void *userData, - const XML_Char *data); +typedef void(XMLCALL *XML_CommentHandler)(void *userData, const XML_Char *data); -typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); -typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); +typedef void(XMLCALL *XML_StartCdataSectionHandler)(void *userData); +typedef void(XMLCALL *XML_EndCdataSectionHandler)(void *userData); /* This is called for any characters in the XML document for which there is no applicable handler. This includes both characters that @@ -288,25 +319,23 @@ typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); default handler: for example, a comment might be split between multiple calls. */ -typedef void (XMLCALL *XML_DefaultHandler) (void *userData, - const XML_Char *s, - int len); +typedef void(XMLCALL *XML_DefaultHandler)(void *userData, const XML_Char *s, + int len); /* This is called for the start of the DOCTYPE declaration, before any DTD or internal subset is parsed. */ -typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( - void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset); +typedef void(XMLCALL *XML_StartDoctypeDeclHandler)(void *userData, + const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset); -/* This is called for the start of the DOCTYPE declaration when the +/* This is called for the end of the DOCTYPE declaration when the closing > is encountered, but after processing any external subset. */ -typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); +typedef void(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); /* This is called for entity declarations. The is_parameter_entity argument will be non-zero if the entity is a parameter entity, zero @@ -314,7 +343,7 @@ typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); For internal entities (), value will be non-NULL and systemId, publicID, and notationName will be NULL. - The value string is NOT nul-terminated; the length is provided in + The value string is NOT null-terminated; the length is provided in the value_length argument. Since it is legal to have zero-length values, do not use this argument to test for internal entities. @@ -326,20 +355,14 @@ typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); Note that is_parameter_entity can't be changed to XML_Bool, since that would break binary compatibility. */ -typedef void (XMLCALL *XML_EntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); +typedef void(XMLCALL *XML_EntityDeclHandler)( + void *userData, const XML_Char *entityName, int is_parameter_entity, + const XML_Char *value, int value_length, const XML_Char *base, + const XML_Char *systemId, const XML_Char *publicId, + const XML_Char *notationName); XMLPARSEAPI(void) -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); +XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler); /* OBSOLETE -- OBSOLETE -- OBSOLETE This handler has been superseded by the EntityDeclHandler above. @@ -350,24 +373,20 @@ XML_SetEntityDeclHandler(XML_Parser parser, entityName, systemId and notationName arguments will never be NULL. The other arguments may be. */ -typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); +typedef void(XMLCALL *XML_UnparsedEntityDeclHandler)( + void *userData, const XML_Char *entityName, const XML_Char *base, + const XML_Char *systemId, const XML_Char *publicId, + const XML_Char *notationName); /* This is called for a declaration of notation. The base argument is whatever was set by XML_SetBase. The notationName will never be NULL. The other arguments can be. */ -typedef void (XMLCALL *XML_NotationDeclHandler) ( - void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); +typedef void(XMLCALL *XML_NotationDeclHandler)(void *userData, + const XML_Char *notationName, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); /* When namespace processing is enabled, these are called once for each namespace declaration. The call to the start and end element @@ -375,14 +394,12 @@ typedef void (XMLCALL *XML_NotationDeclHandler) ( declaration handlers. For an xmlns attribute, prefix will be NULL. For an xmlns="" attribute, uri will be NULL. */ -typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix, - const XML_Char *uri); +typedef void(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData, + const XML_Char *prefix, + const XML_Char *uri); -typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix); +typedef void(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData, + const XML_Char *prefix); /* This is called if the document is not standalone, that is, it has an external subset or a reference to a parameter entity, but does not @@ -393,7 +410,7 @@ typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( conditions above this handler will only be called if the referenced entity was actually read. */ -typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); +typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData); /* This is called for a reference to an external parsed general entity. The referenced entity is not automatically parsed. The @@ -429,12 +446,11 @@ typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); Note that unlike other handlers the first argument is the parser, not userData. */ -typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( - XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); +typedef int(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser parser, + const XML_Char *context, + const XML_Char *base, + const XML_Char *systemId, + const XML_Char *publicId); /* This is called in two situations: 1) An entity reference is encountered for which no declaration @@ -446,10 +462,9 @@ typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( the event would be out of sync with the reporting of the declarations or attribute values */ -typedef void (XMLCALL *XML_SkippedEntityHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity); +typedef void(XMLCALL *XML_SkippedEntityHandler)(void *userData, + const XML_Char *entityName, + int is_parameter_entity); /* This structure is filled in by the XML_UnknownEncodingHandler to provide information to the parser about encodings that are unknown @@ -506,8 +521,8 @@ typedef void (XMLCALL *XML_SkippedEntityHandler) ( typedef struct { int map[256]; void *data; - int (XMLCALL *convert)(void *data, const char *s); - void (XMLCALL *release)(void *data); + int(XMLCALL *convert)(void *data, const char *s); + void(XMLCALL *release)(void *data); } XML_Encoding; /* This is called for an encoding that is unknown to the parser. @@ -523,25 +538,21 @@ typedef struct { Otherwise it must return XML_STATUS_ERROR. If info does not describe a suitable encoding, then the parser will - return an XML_UNKNOWN_ENCODING error. + return an XML_ERROR_UNKNOWN_ENCODING error. */ -typedef int (XMLCALL *XML_UnknownEncodingHandler) ( - void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); +typedef int(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData, + const XML_Char *name, + XML_Encoding *info); XMLPARSEAPI(void) -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, +XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); XMLPARSEAPI(void) -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler handler); +XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler handler); XMLPARSEAPI(void) -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler handler); +XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler handler); XMLPARSEAPI(void) XML_SetCharacterDataHandler(XML_Parser parser, @@ -551,8 +562,7 @@ XMLPARSEAPI(void) XML_SetProcessingInstructionHandler(XML_Parser parser, XML_ProcessingInstructionHandler handler); XMLPARSEAPI(void) -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); +XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler); XMLPARSEAPI(void) XML_SetCdataSectionHandler(XML_Parser parser, @@ -572,20 +582,17 @@ XML_SetEndCdataSectionHandler(XML_Parser parser, default handler, or to the skipped entity handler, if one is set. */ XMLPARSEAPI(void) -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); +XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler); /* This sets the default handler but does not inhibit expansion of internal entities. The entity reference will not be passed to the default handler. */ XMLPARSEAPI(void) -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); +XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler); XMLPARSEAPI(void) -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, +XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); XMLPARSEAPI(void) @@ -593,16 +600,14 @@ XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start); XMLPARSEAPI(void) -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); +XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end); XMLPARSEAPI(void) XML_SetUnparsedEntityDeclHandler(XML_Parser parser, XML_UnparsedEntityDeclHandler handler); XMLPARSEAPI(void) -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); +XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler); XMLPARSEAPI(void) XML_SetNamespaceDeclHandler(XML_Parser parser, @@ -630,8 +635,7 @@ XML_SetExternalEntityRefHandler(XML_Parser parser, instead of the parser object. */ XMLPARSEAPI(void) -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, - void *arg); +XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg); XMLPARSEAPI(void) XML_SetSkippedEntityHandler(XML_Parser parser, @@ -706,11 +710,11 @@ XML_UseParserAsHandlerArg(XML_Parser parser); be called, despite an external subset being parsed. Note: If XML_DTD is not defined when Expat is compiled, returns XML_ERROR_FEATURE_REQUIRES_XML_DTD. + Note: If parser == NULL, returns XML_ERROR_INVALID_ARGUMENT. */ XMLPARSEAPI(enum XML_Error) XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); - /* Sets the base to be used for resolving relative URIs in system identifiers in declarations. Resolving relative identifiers is left to the application: this value will be passed through as the @@ -728,16 +732,17 @@ XML_GetBase(XML_Parser parser); /* Returns the number of the attribute/value pairs passed in last call to the XML_StartElementHandler that were specified in the start-tag rather than defaulted. Each attribute/value pair counts as 2; thus - this correspondds to an index into the atts array passed to the - XML_StartElementHandler. + this corresponds to an index into the atts array passed to the + XML_StartElementHandler. Returns -1 if parser == NULL. */ XMLPARSEAPI(int) XML_GetSpecifiedAttributeCount(XML_Parser parser); /* Returns the index of the ID attribute passed in the last call to - XML_StartElementHandler, or -1 if there is no ID attribute. Each - attribute/value pair counts as 2; thus this correspondds to an - index into the atts array passed to the XML_StartElementHandler. + XML_StartElementHandler, or -1 if there is no ID attribute or + parser == NULL. Each attribute/value pair counts as 2; thus this + corresponds to an index into the atts array passed to the + XML_StartElementHandler. */ XMLPARSEAPI(int) XML_GetIdAttributeIndex(XML_Parser parser); @@ -749,10 +754,10 @@ XML_GetIdAttributeIndex(XML_Parser parser); info->valueEnd - info->valueStart = 4 bytes. */ typedef struct { - XML_Index nameStart; /* Offset to beginning of the attribute name. */ - XML_Index nameEnd; /* Offset after the attribute name's last byte. */ - XML_Index valueStart; /* Offset to beginning of the attribute value. */ - XML_Index valueEnd; /* Offset after the attribute value's last byte. */ + XML_Index nameStart; /* Offset to beginning of the attribute name. */ + XML_Index nameEnd; /* Offset after the attribute name's last byte. */ + XML_Index valueStart; /* Offset to beginning of the attribute value. */ + XML_Index valueEnd; /* Offset after the attribute value's last byte. */ } XML_AttrInfo; /* Returns an array of XML_AttrInfo structures for the attribute/value pairs @@ -788,20 +793,20 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal); (resumable = 0) an already suspended parser. Some call-backs may still follow because they would otherwise get lost. Examples: - endElementHandler() for empty elements when stopped in - startElementHandler(), - - endNameSpaceDeclHandler() when stopped in endElementHandler(), + startElementHandler(), + - endNameSpaceDeclHandler() when stopped in endElementHandler(), and possibly others. Can be called from most handlers, including DTD related call-backs, except when parsing an external parameter entity and resumable != 0. Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. - Possible error codes: + Possible error codes: - XML_ERROR_SUSPENDED: when suspending an already suspended parser. - XML_ERROR_FINISHED: when the parser has already finished. - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. - When resumable != 0 (true) then parsing is suspended, that is, - XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. + When resumable != 0 (true) then parsing is suspended, that is, + XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. @@ -812,7 +817,7 @@ XML_ParseBuffer(XML_Parser parser, int len, int isFinal); the externalEntityRefHandler() to call XML_StopParser() on the parent parser (recursively), if one wants to stop parsing altogether. - When suspended, parsing can be resumed by calling XML_ResumeParser(). + When suspended, parsing can be resumed by calling XML_ResumeParser(). */ XMLPARSEAPI(enum XML_Status) XML_StopParser(XML_Parser parser, XML_Bool resumable); @@ -820,7 +825,7 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable); /* Resumes parsing after it has been suspended with XML_StopParser(). Must not be called from within a handler call-back. Returns same status codes as XML_Parse() or XML_ParseBuffer(). - Additional error code XML_ERROR_NOT_SUSPENDED possible. + Additional error code XML_ERROR_NOT_SUSPENDED possible. *Note*: This must be called on the most deeply nested child parser instance @@ -832,12 +837,7 @@ XML_StopParser(XML_Parser parser, XML_Bool resumable); XMLPARSEAPI(enum XML_Status) XML_ResumeParser(XML_Parser parser); -enum XML_Parsing { - XML_INITIALIZED, - XML_PARSING, - XML_FINISHED, - XML_SUSPENDED -}; +enum XML_Parsing { XML_INITIALIZED, XML_PARSING, XML_FINISHED, XML_SUSPENDED }; typedef struct { enum XML_Parsing parsing; @@ -869,8 +869,7 @@ XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); Otherwise returns a new XML_Parser object. */ XMLPARSEAPI(XML_Parser) -XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, +XML_ExternalEntityParserCreate(XML_Parser parser, const XML_Char *context, const XML_Char *encoding); enum XML_ParamEntityParsing { @@ -901,6 +900,7 @@ enum XML_ParamEntityParsing { entities is requested; otherwise it will return non-zero. Note: If XML_SetParamEntityParsing is called after XML_Parse or XML_ParseBuffer, then it has no effect and will always return 0. + Note: If parser == NULL, the function will do nothing and return 0. */ XMLPARSEAPI(int) XML_SetParamEntityParsing(XML_Parser parser, @@ -910,10 +910,10 @@ XML_SetParamEntityParsing(XML_Parser parser, Helps in preventing DoS attacks based on predicting hash function behavior. This must be called before parsing is started. Returns 1 if successful, 0 when called after parsing has started. + Note: If parser == NULL, the function will do nothing and return 0. */ XMLPARSEAPI(int) -XML_SetHashSalt(XML_Parser parser, - unsigned long hash_salt); +XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt); /* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then XML_GetErrorCode returns information about the error. @@ -930,12 +930,16 @@ XML_GetErrorCode(XML_Parser parser); be within the relevant markup. When called outside of the callback functions, the position indicated will be just past the last parse event (regardless of whether there was an associated callback). - + They may also be called after returning from a call to XML_Parse or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then the location is the location of the character at which the error was detected; otherwise the location is the location of the last parse event, as described above. + + Note: XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber + return 0 to indicate an error. + Note: XML_GetCurrentByteIndex returns -1 to indicate an error. */ XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); @@ -958,14 +962,12 @@ XML_GetCurrentByteCount(XML_Parser parser); the handler that makes the call. */ XMLPARSEAPI(const char *) -XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); +XML_GetInputContext(XML_Parser parser, int *offset, int *size); /* For backwards compatibility with previous versions. */ -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber +#define XML_GetErrorLineNumber XML_GetCurrentLineNumber #define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex +#define XML_GetErrorByteIndex XML_GetCurrentByteIndex /* Frees the content model passed to the element declaration handler */ XMLPARSEAPI(void) @@ -1020,25 +1022,39 @@ enum XML_FeatureEnum { XML_FEATURE_SIZEOF_XML_LCHAR, XML_FEATURE_NS, XML_FEATURE_LARGE_SIZE, - XML_FEATURE_ATTR_INFO + XML_FEATURE_ATTR_INFO, + /* Added in Expat 2.4.0. */ + XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT, + XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT /* Additional features must be added to the end of this enum. */ }; typedef struct { - enum XML_FeatureEnum feature; - const XML_LChar *name; - long int value; + enum XML_FeatureEnum feature; + const XML_LChar *name; + long int value; } XML_Feature; XMLPARSEAPI(const XML_Feature *) XML_GetFeatureList(void); +#ifdef XML_DTD +/* Added in Expat 2.4.0. */ +XMLPARSEAPI(XML_Bool) +XML_SetBillionLaughsAttackProtectionMaximumAmplification( + XML_Parser parser, float maximumAmplificationFactor); + +/* Added in Expat 2.4.0. */ +XMLPARSEAPI(XML_Bool) +XML_SetBillionLaughsAttackProtectionActivationThreshold( + XML_Parser parser, unsigned long long activationThresholdBytes); +#endif /* Expat follows the semantic versioning convention. See http://semver.org. */ #define XML_MAJOR_VERSION 2 -#define XML_MINOR_VERSION 2 +#define XML_MINOR_VERSION 5 #define XML_MICRO_VERSION 0 #ifdef __cplusplus diff --git a/deps/EXPAT/expat/expat_config.h b/deps/EXPAT/expat/expat_config.h index 8aa80db0d..e138db987 100644 --- a/deps/EXPAT/expat/expat_config.h +++ b/deps/EXPAT/expat/expat_config.h @@ -1,28 +1,40 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Greg Stein + Copyright (c) 2005 Karl Waclawek + Copyright (c) 2017-2021 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef EXPATCONFIG_H #define EXPATCONFIG_H -#include -#include - -#define XML_NS 1 -#define XML_DTD 1 -#define XML_CONTEXT_BYTES 1024 - -/* we will assume all Windows platforms are little endian */ -#define BYTEORDER 1234 - -/* Windows has memmove() available. */ -#define HAVE_MEMMOVE - #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include @@ -30,4 +42,8 @@ #else #endif -#endif /* ifndef EXPATCONFIG_H */ +#include "expat_configure.h" +#include +#include + +#endif /* ndef EXPATCONFIG_H */ diff --git a/deps/EXPAT/expat/expat_configure.h.cmake b/deps/EXPAT/expat/expat_configure.h.cmake new file mode 100644 index 000000000..78fcb4cad --- /dev/null +++ b/deps/EXPAT/expat/expat_configure.h.cmake @@ -0,0 +1,120 @@ +/* expat_config.h.cmake. Based upon generated expat_config.h.in. */ + +#ifndef EXPAT_CONFIG_H +#define EXPAT_CONFIG_H 1 + +/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ +#cmakedefine BYTEORDER @BYTEORDER@ + +/* Define to 1 if you have the `arc4random' function. */ +#cmakedefine HAVE_ARC4RANDOM + +/* Define to 1 if you have the `arc4random_buf' function. */ +#cmakedefine HAVE_ARC4RANDOM_BUF + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H + +/* Define to 1 if you have the `getpagesize' function. */ +#cmakedefine HAVE_GETPAGESIZE + +/* Define to 1 if you have the `getrandom' function. */ +#cmakedefine HAVE_GETRANDOM + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H + +/* Define to 1 if you have the `bsd' library (-lbsd). */ +#cmakedefine HAVE_LIBBSD + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H + +/* Define to 1 if you have a working `mmap' system call. */ +#cmakedefine HAVE_MMAP + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H + +/* Define to 1 if you have `syscall' and `SYS_getrandom'. */ +#cmakedefine HAVE_SYSCALL_GETRANDOM + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H + +/* Name of package */ +#define PACKAGE "@PACKAGE_NAME@" + +/* Define to the address where bug reports for this package should be sent. */ +#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" + +/* Define to the full name of this package. */ +#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@" + +/* Define to the full name and version of this package. */ +#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@" + +/* Define to the one symbol short name of this package. */ +#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@" + +/* Define to 1 if you have the ANSI C header files. */ +#cmakedefine STDC_HEADERS + +/* whether byteorder is bigendian */ +#cmakedefine WORDS_BIGENDIAN + +/* Define to allow retrieving the byte offsets for attribute names and values. + */ +#cmakedefine XML_ATTR_INFO + +/* Define to specify how much context to retain around the current parse + point. */ +#cmakedefine XML_CONTEXT_BYTES @XML_CONTEXT_BYTES@ + +#if ! defined(_WIN32) +/* Define to include code reading entropy from `/dev/urandom'. */ +#cmakedefine XML_DEV_URANDOM +#endif + +/* Define to make parameter entity parsing functionality available. */ +#cmakedefine XML_DTD + +/* Define to make XML Namespaces functionality available. */ +#cmakedefine XML_NS + +/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ +#ifdef _MSC_VER +# define __func__ __FUNCTION__ +#endif + +/* Define to `long' if does not define. */ +#cmakedefine off_t @OFF_T@ + +/* Define to `unsigned' if does not define. */ +#cmakedefine size_t @SIZE_T@ + +#endif // ndef EXPAT_CONFIG_H diff --git a/deps/EXPAT/expat/expat_external.h b/deps/EXPAT/expat/expat_external.h index 56cd84367..5894f1dc9 100644 --- a/deps/EXPAT/expat/expat_external.h +++ b/deps/EXPAT/expat/expat_external.h @@ -1,5 +1,40 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2000-2004 Fred L. Drake, Jr. + Copyright (c) 2001-2002 Greg Stein + Copyright (c) 2002-2006 Karl Waclawek + Copyright (c) 2016 Cristian Rodríguez + Copyright (c) 2016-2019 Sebastian Pipping + Copyright (c) 2017 Rhodri James + Copyright (c) 2018 Yury Gribov + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef Expat_External_INCLUDED @@ -7,10 +42,6 @@ /* External API definitions */ -#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) -#define XML_USE_MSC_EXTENSIONS 1 -#endif - /* Expat tries very hard to make the API boundary very specifically defined. There are two macros defined to control this boundary; each of these can be defined before including this header to @@ -34,11 +65,11 @@ system headers may assume the cdecl convention. */ #ifndef XMLCALL -#if defined(_MSC_VER) -#define XMLCALL __cdecl -#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) -#define XMLCALL __attribute__((cdecl)) -#else +# if defined(_MSC_VER) +# define XMLCALL __cdecl +# elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER) +# define XMLCALL __attribute__((cdecl)) +# else /* For any platform which uses this definition and supports more than one calling convention, we need to extend this definition to declare the convention used on that platform, if it's possible to @@ -49,41 +80,46 @@ pre-processor and how to specify the same calling convention as the platform's malloc() implementation. */ -#define XMLCALL -#endif -#endif /* not defined XMLCALL */ +# define XMLCALL +# endif +#endif /* not defined XMLCALL */ - -#if !defined(XML_STATIC) && !defined(XMLIMPORT) -#ifndef XML_BUILDING_EXPAT +#if ! defined(XML_STATIC) && ! defined(XMLIMPORT) +# ifndef XML_BUILDING_EXPAT /* using Expat from an application */ -#ifdef XML_USE_MSC_EXTENSIONS -// #define XMLIMPORT __declspec(dllimport) +# if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__) +//# define XMLIMPORT __declspec(dllimport) +# endif + +# endif +#endif /* not defined XML_STATIC */ + +#ifndef XML_ENABLE_VISIBILITY +# define XML_ENABLE_VISIBILITY 0 #endif -#endif -#endif /* not defined XML_STATIC */ - -#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4) -#define XMLIMPORT __attribute__ ((visibility ("default"))) +#if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY +# define XMLIMPORT __attribute__((visibility("default"))) #endif /* If we didn't define it above, define it away: */ #ifndef XMLIMPORT -#define XMLIMPORT +# define XMLIMPORT #endif -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) -#define XML_ATTR_MALLOC __attribute__((__malloc__)) +#if defined(__GNUC__) \ + && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) +# define XML_ATTR_MALLOC __attribute__((__malloc__)) #else -#define XML_ATTR_MALLOC +# define XML_ATTR_MALLOC #endif -#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) -#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) +#if defined(__GNUC__) \ + && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) +# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) #else -#define XML_ATTR_ALLOC_SIZE(x) +# define XML_ATTR_ALLOC_SIZE(x) #endif #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL @@ -93,30 +129,30 @@ extern "C" { #endif #ifdef XML_UNICODE_WCHAR_T -#define XML_UNICODE +# ifndef XML_UNICODE +# define XML_UNICODE +# endif +# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2) +# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc" +# endif #endif -#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ -#ifdef XML_UNICODE_WCHAR_T +#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ +# ifdef XML_UNICODE_WCHAR_T typedef wchar_t XML_Char; typedef wchar_t XML_LChar; -#else +# else typedef unsigned short XML_Char; typedef char XML_LChar; -#endif /* XML_UNICODE_WCHAR_T */ -#else /* Information is UTF-8 encoded. */ +# endif /* XML_UNICODE_WCHAR_T */ +#else /* Information is UTF-8 encoded. */ typedef char XML_Char; typedef char XML_LChar; -#endif /* XML_UNICODE */ +#endif /* XML_UNICODE */ -#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -typedef __int64 XML_Index; -typedef unsigned __int64 XML_Size; -#else +#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ typedef long long XML_Index; typedef unsigned long long XML_Size; -#endif #else typedef long XML_Index; typedef unsigned long XML_Size; diff --git a/deps/EXPAT/expat/iasciitab.h b/deps/EXPAT/expat/iasciitab.h index 24a1d5ccc..5d8646f2a 100644 --- a/deps/EXPAT/expat/iasciitab.h +++ b/deps/EXPAT/expat/iasciitab.h @@ -1,37 +1,67 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2017 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, + /* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, + /* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, + /* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, + /* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, + /* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, + /* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, + /* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, + /* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, + /* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, + /* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, + /* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, + /* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, + /* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, + /* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, + /* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, + /* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, + /* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/deps/EXPAT/expat/internal.h b/deps/EXPAT/expat/internal.h index 94cb98e15..e09f533b2 100644 --- a/deps/EXPAT/expat/internal.h +++ b/deps/EXPAT/expat/internal.h @@ -18,9 +18,42 @@ Note: Use of these macros is based on judgement, not hard rules, and therefore subject to change. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 2002-2003 Fred L. Drake, Jr. + Copyright (c) 2002-2006 Karl Waclawek + Copyright (c) 2003 Greg Stein + Copyright (c) 2016-2022 Sebastian Pipping + Copyright (c) 2018 Yury Gribov + Copyright (c) 2019 David Loffredo + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) +#if defined(__GNUC__) && defined(__i386__) && ! defined(__MINGW32__) /* We'll use this version by default only where we know it helps. regparm() generates warnings on Solaris boxes. See SF bug #692878. @@ -30,8 +63,8 @@ #define FASTCALL __attribute__((stdcall, regparm(3))) and let's try this: */ -#define FASTCALL __attribute__((regparm(3))) -#define PTRFASTCALL __attribute__((regparm(3))) +# define FASTCALL __attribute__((regparm(3))) +# define PTRFASTCALL __attribute__((regparm(3))) #endif /* Using __fastcall seems to have an unexpected negative effect under @@ -45,50 +78,87 @@ /* Make sure all of these are defined if they aren't already. */ #ifndef FASTCALL -#define FASTCALL +# define FASTCALL #endif #ifndef PTRCALL -#define PTRCALL +# define PTRCALL #endif #ifndef PTRFASTCALL -#define PTRFASTCALL +# define PTRFASTCALL #endif #ifndef XML_MIN_SIZE -#if !defined(__cplusplus) && !defined(inline) -#ifdef __GNUC__ -#define inline __inline -#endif /* __GNUC__ */ -#endif +# if ! defined(__cplusplus) && ! defined(inline) +# ifdef __GNUC__ +# define inline __inline +# endif /* __GNUC__ */ +# endif #endif /* XML_MIN_SIZE */ #ifdef __cplusplus -#define inline inline +# define inline inline #else -#ifndef inline -#define inline +# ifndef inline +# define inline +# endif #endif + +#include // ULONG_MAX + +#if defined(_WIN32) \ + && (! defined(__USE_MINGW_ANSI_STDIO) \ + || (1 - __USE_MINGW_ANSI_STDIO - 1 == 0)) +# define EXPAT_FMT_ULL(midpart) "%" midpart "I64u" +# if defined(_WIN64) // Note: modifiers "td" and "zu" do not work for MinGW +# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "I64d" +# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "I64u" +# else +# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d" +# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u" +# endif +#else +# define EXPAT_FMT_ULL(midpart) "%" midpart "llu" +# if ! defined(ULONG_MAX) +# error Compiler did not define ULONG_MAX for us +# elif ULONG_MAX == 18446744073709551615u // 2^64-1 +# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "ld" +# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "lu" +# else +# define EXPAT_FMT_PTRDIFF_T(midpart) "%" midpart "d" +# define EXPAT_FMT_SIZE_T(midpart) "%" midpart "u" +# endif #endif #ifndef UNUSED_P -# ifdef __GNUC__ -# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__)) -# else -# define UNUSED_P(p) UNUSED_ ## p -# endif +# define UNUSED_P(p) (void)p #endif +/* NOTE BEGIN If you ever patch these defaults to greater values + for non-attack XML payload in your environment, + please file a bug report with libexpat. Thank you! +*/ +#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT \ + 100.0f +#define EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT \ + 8388608 // 8 MiB, 2^23 +/* NOTE END */ + +#include "expat.h" // so we can use type XML_Parser below #ifdef __cplusplus extern "C" { #endif +void _INTERNAL_trim_to_complete_utf8_characters(const char *from, + const char **fromLimRef); -void -align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef); - +#if defined(XML_DTD) +unsigned long long testingAccountingGetCountBytesDirect(XML_Parser parser); +unsigned long long testingAccountingGetCountBytesIndirect(XML_Parser parser); +const char *unsignedCharToPrintable(unsigned char c); +#endif #ifdef __cplusplus } diff --git a/deps/EXPAT/expat/latin1tab.h b/deps/EXPAT/expat/latin1tab.h index 53c25d76b..b681d278a 100644 --- a/deps/EXPAT/expat/latin1tab.h +++ b/deps/EXPAT/expat/latin1tab.h @@ -1,36 +1,66 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2017 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, -/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, + /* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, + /* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, + /* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, + /* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, + /* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, + /* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, + /* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, diff --git a/deps/EXPAT/expat/nametab.h b/deps/EXPAT/expat/nametab.h index b05e62c77..63485446b 100644 --- a/deps/EXPAT/expat/nametab.h +++ b/deps/EXPAT/expat/nametab.h @@ -1,150 +1,136 @@ +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 2000 Clark Cooper + Copyright (c) 2017 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + static const unsigned namingBitmap[] = { -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, -0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, -0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, -0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, -0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, -0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, -0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, -0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, -0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, -0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, -0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, -0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, -0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, -0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, -0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, -0x40000000, 0xF580C900, 0x00000007, 0x02010800, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, -0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, -0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, -0x00000000, 0x00004C40, 0x00000000, 0x00000000, -0x00000007, 0x00000000, 0x00000000, 0x00000000, -0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, -0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, -0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, -0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, -0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, -0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, -0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, -0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, -0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, -0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, -0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, -0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, -0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, -0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, -0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, -0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, -0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, -0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0x04000000, + 0x87FFFFFE, 0x07FFFFFE, 0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, + 0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFE00F, 0xFC31FFFF, 0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, + 0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, + 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, 0xFFFF0003, 0xFFFFFFFF, + 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, + 0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, 0x00000000, 0x07FFFFFE, + 0x000007FE, 0xFFFE0000, 0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, + 0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, 0xFFF99FE0, 0x03C5FDFF, + 0xB0000000, 0x00030003, 0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, + 0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, 0xFFF99FE0, 0x23CDFDFF, + 0xB0000000, 0x00000003, 0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, + 0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, 0xFFFDDFE0, 0x03EFFDFF, + 0x40000000, 0x00000003, 0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFE, 0x000D7FFF, + 0x0000003F, 0x00000000, 0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, + 0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, 0x0007DAED, 0x50000000, + 0x82315001, 0x002C62AB, 0x40000000, 0xF580C900, 0x00000007, 0x02010800, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0FFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0x03FFFFFF, 0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, + 0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, 0x00000000, 0x00004C40, + 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000000, + 0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, 0x001FFFFF, 0xFFFFFFFE, + 0xFFFFFFFF, 0x07FFFFFF, 0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0000000F, + 0x00000000, 0x00000000, 0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, + 0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, 0x00FFFFFF, 0x00000000, + 0xFFFF0000, 0xFFFFFFFF, 0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, + 0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, 0xFFFFD7C0, 0xFFFFFFFB, + 0x547F7FFF, 0x000FFFFD, 0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, + 0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, 0x00000000, 0xFFFE0000, + 0x027FFFFF, 0xFFFFFFFE, 0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, + 0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, 0xFFFFFFFF, 0x7CFFFFFF, + 0xFFEF7FFF, 0x03FF3DFF, 0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, + 0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, 0xFFF987E4, 0xD36DFDFF, + 0x5E003987, 0x001FFFC0, 0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, + 0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, 0xD63DC7EC, 0xC3BFC718, + 0x00803DC7, 0x0000FF80, 0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, + 0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, 0xFFFDDFEC, 0xC3FFFDFF, + 0x00803DCF, 0x0000FFC3, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, 0xFEF02596, 0x3BFF6CAE, + 0x03FF3F5F, 0x00000000, 0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, + 0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, + 0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, 0x661FFFFF, 0xFFFFFFFE, + 0xFFFFFFFF, 0x77FFFFFF, }; static const unsigned char nmstrtPages[] = { -0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, -0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00, 0x09, 0x0A, 0x0B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x00, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; static const unsigned char namePages[] = { -0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, -0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, 0x00, 0x1F, 0x20, 0x21, + 0x22, 0x23, 0x24, 0x25, 0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, 0x26, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; diff --git a/deps/EXPAT/expat/siphash.h b/deps/EXPAT/expat/siphash.h new file mode 100644 index 000000000..303283ad2 --- /dev/null +++ b/deps/EXPAT/expat/siphash.h @@ -0,0 +1,393 @@ +/* ========================================================================== + * siphash.h - SipHash-2-4 in a single header file + * -------------------------------------------------------------------------- + * Derived by William Ahern from the reference implementation[1] published[2] + * by Jean-Philippe Aumasson and Daniel J. Berstein. + * Minimal changes by Sebastian Pipping and Victor Stinner on top, see below. + * Licensed under the CC0 Public Domain Dedication license. + * + * 1. https://www.131002.net/siphash/siphash24.c + * 2. https://www.131002.net/siphash/ + * -------------------------------------------------------------------------- + * HISTORY: + * + * 2020-10-03 (Sebastian Pipping) + * - Drop support for Visual Studio 9.0/2008 and earlier + * + * 2019-08-03 (Sebastian Pipping) + * - Mark part of sip24_valid as to be excluded from clang-format + * - Re-format code using clang-format 9 + * + * 2018-07-08 (Anton Maklakov) + * - Add "fall through" markers for GCC's -Wimplicit-fallthrough + * + * 2017-11-03 (Sebastian Pipping) + * - Hide sip_tobin and sip_binof unless SIPHASH_TOBIN macro is defined + * + * 2017-07-25 (Vadim Zeitlin) + * - Fix use of SIPHASH_MAIN macro + * + * 2017-07-05 (Sebastian Pipping) + * - Use _SIP_ULL macro to not require a C++11 compiler if compiled as C++ + * - Add const qualifiers at two places + * - Ensure <=80 characters line length (assuming tab width 4) + * + * 2017-06-23 (Victor Stinner) + * - Address Win64 compile warnings + * + * 2017-06-18 (Sebastian Pipping) + * - Clarify license note in the header + * - Address C89 issues: + * - Stop using inline keyword (and let compiler decide) + * - Replace _Bool by int + * - Turn macro siphash24 into a function + * - Address invalid conversion (void pointer) by explicit cast + * - Address lack of stdint.h for Visual Studio 2003 to 2008 + * - Always expose sip24_valid (for self-tests) + * + * 2012-11-04 - Born. (William Ahern) + * -------------------------------------------------------------------------- + * USAGE: + * + * SipHash-2-4 takes as input two 64-bit words as the key, some number of + * message bytes, and outputs a 64-bit word as the message digest. This + * implementation employs two data structures: a struct sipkey for + * representing the key, and a struct siphash for representing the hash + * state. + * + * For converting a 16-byte unsigned char array to a key, use either the + * macro sip_keyof or the routine sip_tokey. The former instantiates a + * compound literal key, while the latter requires a key object as a + * parameter. + * + * unsigned char secret[16]; + * arc4random_buf(secret, sizeof secret); + * struct sipkey *key = sip_keyof(secret); + * + * For hashing a message, use either the convenience macro siphash24 or the + * routines sip24_init, sip24_update, and sip24_final. + * + * struct siphash state; + * void *msg; + * size_t len; + * uint64_t hash; + * + * sip24_init(&state, key); + * sip24_update(&state, msg, len); + * hash = sip24_final(&state); + * + * or + * + * hash = siphash24(msg, len, key); + * + * To convert the 64-bit hash value to a canonical 8-byte little-endian + * binary representation, use either the macro sip_binof or the routine + * sip_tobin. The former instantiates and returns a compound literal array, + * while the latter requires an array object as a parameter. + * -------------------------------------------------------------------------- + * NOTES: + * + * o Neither sip_keyof, sip_binof, nor siphash24 will work with compilers + * lacking compound literal support. Instead, you must use the lower-level + * interfaces which take as parameters the temporary state objects. + * + * o Uppercase macros may evaluate parameters more than once. Lowercase + * macros should not exhibit any such side effects. + * ========================================================================== + */ +#ifndef SIPHASH_H +#define SIPHASH_H + +#include /* size_t */ +#include /* uint64_t uint32_t uint8_t */ + +/* + * Workaround to not require a C++11 compiler for using ULL suffix + * if this code is included and compiled as C++; related GCC warning is: + * warning: use of C++11 long long integer constant [-Wlong-long] + */ +#define _SIP_ULL(high, low) ((((uint64_t)high) << 32) | (low)) + +#define SIP_ROTL(x, b) (uint64_t)(((x) << (b)) | ((x) >> (64 - (b)))) + +#define SIP_U32TO8_LE(p, v) \ + (p)[0] = (uint8_t)((v) >> 0); \ + (p)[1] = (uint8_t)((v) >> 8); \ + (p)[2] = (uint8_t)((v) >> 16); \ + (p)[3] = (uint8_t)((v) >> 24); + +#define SIP_U64TO8_LE(p, v) \ + SIP_U32TO8_LE((p) + 0, (uint32_t)((v) >> 0)); \ + SIP_U32TO8_LE((p) + 4, (uint32_t)((v) >> 32)); + +#define SIP_U8TO64_LE(p) \ + (((uint64_t)((p)[0]) << 0) | ((uint64_t)((p)[1]) << 8) \ + | ((uint64_t)((p)[2]) << 16) | ((uint64_t)((p)[3]) << 24) \ + | ((uint64_t)((p)[4]) << 32) | ((uint64_t)((p)[5]) << 40) \ + | ((uint64_t)((p)[6]) << 48) | ((uint64_t)((p)[7]) << 56)) + +#define SIPHASH_INITIALIZER \ + { 0, 0, 0, 0, {0}, 0, 0 } + +struct siphash { + uint64_t v0, v1, v2, v3; + + unsigned char buf[8], *p; + uint64_t c; +}; /* struct siphash */ + +#define SIP_KEYLEN 16 + +struct sipkey { + uint64_t k[2]; +}; /* struct sipkey */ + +#define sip_keyof(k) sip_tokey(&(struct sipkey){{0}}, (k)) + +static struct sipkey * +sip_tokey(struct sipkey *key, const void *src) { + key->k[0] = SIP_U8TO64_LE((const unsigned char *)src); + key->k[1] = SIP_U8TO64_LE((const unsigned char *)src + 8); + return key; +} /* sip_tokey() */ + +#ifdef SIPHASH_TOBIN + +# define sip_binof(v) sip_tobin((unsigned char[8]){0}, (v)) + +static void * +sip_tobin(void *dst, uint64_t u64) { + SIP_U64TO8_LE((unsigned char *)dst, u64); + return dst; +} /* sip_tobin() */ + +#endif /* SIPHASH_TOBIN */ + +static void +sip_round(struct siphash *H, const int rounds) { + int i; + + for (i = 0; i < rounds; i++) { + H->v0 += H->v1; + H->v1 = SIP_ROTL(H->v1, 13); + H->v1 ^= H->v0; + H->v0 = SIP_ROTL(H->v0, 32); + + H->v2 += H->v3; + H->v3 = SIP_ROTL(H->v3, 16); + H->v3 ^= H->v2; + + H->v0 += H->v3; + H->v3 = SIP_ROTL(H->v3, 21); + H->v3 ^= H->v0; + + H->v2 += H->v1; + H->v1 = SIP_ROTL(H->v1, 17); + H->v1 ^= H->v2; + H->v2 = SIP_ROTL(H->v2, 32); + } +} /* sip_round() */ + +static struct siphash * +sip24_init(struct siphash *H, const struct sipkey *key) { + H->v0 = _SIP_ULL(0x736f6d65U, 0x70736575U) ^ key->k[0]; + H->v1 = _SIP_ULL(0x646f7261U, 0x6e646f6dU) ^ key->k[1]; + H->v2 = _SIP_ULL(0x6c796765U, 0x6e657261U) ^ key->k[0]; + H->v3 = _SIP_ULL(0x74656462U, 0x79746573U) ^ key->k[1]; + + H->p = H->buf; + H->c = 0; + + return H; +} /* sip24_init() */ + +#define sip_endof(a) (&(a)[sizeof(a) / sizeof *(a)]) + +static struct siphash * +sip24_update(struct siphash *H, const void *src, size_t len) { + const unsigned char *p = (const unsigned char *)src, *pe = p + len; + uint64_t m; + + do { + while (p < pe && H->p < sip_endof(H->buf)) + *H->p++ = *p++; + + if (H->p < sip_endof(H->buf)) + break; + + m = SIP_U8TO64_LE(H->buf); + H->v3 ^= m; + sip_round(H, 2); + H->v0 ^= m; + + H->p = H->buf; + H->c += 8; + } while (p < pe); + + return H; +} /* sip24_update() */ + +static uint64_t +sip24_final(struct siphash *H) { + const char left = (char)(H->p - H->buf); + uint64_t b = (H->c + left) << 56; + + switch (left) { + case 7: + b |= (uint64_t)H->buf[6] << 48; + /* fall through */ + case 6: + b |= (uint64_t)H->buf[5] << 40; + /* fall through */ + case 5: + b |= (uint64_t)H->buf[4] << 32; + /* fall through */ + case 4: + b |= (uint64_t)H->buf[3] << 24; + /* fall through */ + case 3: + b |= (uint64_t)H->buf[2] << 16; + /* fall through */ + case 2: + b |= (uint64_t)H->buf[1] << 8; + /* fall through */ + case 1: + b |= (uint64_t)H->buf[0] << 0; + /* fall through */ + case 0: + break; + } + + H->v3 ^= b; + sip_round(H, 2); + H->v0 ^= b; + H->v2 ^= 0xff; + sip_round(H, 4); + + return H->v0 ^ H->v1 ^ H->v2 ^ H->v3; +} /* sip24_final() */ + +static uint64_t +siphash24(const void *src, size_t len, const struct sipkey *key) { + struct siphash state = SIPHASH_INITIALIZER; + return sip24_final(sip24_update(sip24_init(&state, key), src, len)); +} /* siphash24() */ + +/* + * SipHash-2-4 output with + * k = 00 01 02 ... + * and + * in = (empty string) + * in = 00 (1 byte) + * in = 00 01 (2 bytes) + * in = 00 01 02 (3 bytes) + * ... + * in = 00 01 02 ... 3e (63 bytes) + */ +static int +sip24_valid(void) { + /* clang-format off */ + static const unsigned char vectors[64][8] = { + { 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, }, + { 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, }, + { 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, }, + { 0x2d, 0x7e, 0xfb, 0xd7, 0x96, 0x66, 0x67, 0x85, }, + { 0xb7, 0x87, 0x71, 0x27, 0xe0, 0x94, 0x27, 0xcf, }, + { 0x8d, 0xa6, 0x99, 0xcd, 0x64, 0x55, 0x76, 0x18, }, + { 0xce, 0xe3, 0xfe, 0x58, 0x6e, 0x46, 0xc9, 0xcb, }, + { 0x37, 0xd1, 0x01, 0x8b, 0xf5, 0x00, 0x02, 0xab, }, + { 0x62, 0x24, 0x93, 0x9a, 0x79, 0xf5, 0xf5, 0x93, }, + { 0xb0, 0xe4, 0xa9, 0x0b, 0xdf, 0x82, 0x00, 0x9e, }, + { 0xf3, 0xb9, 0xdd, 0x94, 0xc5, 0xbb, 0x5d, 0x7a, }, + { 0xa7, 0xad, 0x6b, 0x22, 0x46, 0x2f, 0xb3, 0xf4, }, + { 0xfb, 0xe5, 0x0e, 0x86, 0xbc, 0x8f, 0x1e, 0x75, }, + { 0x90, 0x3d, 0x84, 0xc0, 0x27, 0x56, 0xea, 0x14, }, + { 0xee, 0xf2, 0x7a, 0x8e, 0x90, 0xca, 0x23, 0xf7, }, + { 0xe5, 0x45, 0xbe, 0x49, 0x61, 0xca, 0x29, 0xa1, }, + { 0xdb, 0x9b, 0xc2, 0x57, 0x7f, 0xcc, 0x2a, 0x3f, }, + { 0x94, 0x47, 0xbe, 0x2c, 0xf5, 0xe9, 0x9a, 0x69, }, + { 0x9c, 0xd3, 0x8d, 0x96, 0xf0, 0xb3, 0xc1, 0x4b, }, + { 0xbd, 0x61, 0x79, 0xa7, 0x1d, 0xc9, 0x6d, 0xbb, }, + { 0x98, 0xee, 0xa2, 0x1a, 0xf2, 0x5c, 0xd6, 0xbe, }, + { 0xc7, 0x67, 0x3b, 0x2e, 0xb0, 0xcb, 0xf2, 0xd0, }, + { 0x88, 0x3e, 0xa3, 0xe3, 0x95, 0x67, 0x53, 0x93, }, + { 0xc8, 0xce, 0x5c, 0xcd, 0x8c, 0x03, 0x0c, 0xa8, }, + { 0x94, 0xaf, 0x49, 0xf6, 0xc6, 0x50, 0xad, 0xb8, }, + { 0xea, 0xb8, 0x85, 0x8a, 0xde, 0x92, 0xe1, 0xbc, }, + { 0xf3, 0x15, 0xbb, 0x5b, 0xb8, 0x35, 0xd8, 0x17, }, + { 0xad, 0xcf, 0x6b, 0x07, 0x63, 0x61, 0x2e, 0x2f, }, + { 0xa5, 0xc9, 0x1d, 0xa7, 0xac, 0xaa, 0x4d, 0xde, }, + { 0x71, 0x65, 0x95, 0x87, 0x66, 0x50, 0xa2, 0xa6, }, + { 0x28, 0xef, 0x49, 0x5c, 0x53, 0xa3, 0x87, 0xad, }, + { 0x42, 0xc3, 0x41, 0xd8, 0xfa, 0x92, 0xd8, 0x32, }, + { 0xce, 0x7c, 0xf2, 0x72, 0x2f, 0x51, 0x27, 0x71, }, + { 0xe3, 0x78, 0x59, 0xf9, 0x46, 0x23, 0xf3, 0xa7, }, + { 0x38, 0x12, 0x05, 0xbb, 0x1a, 0xb0, 0xe0, 0x12, }, + { 0xae, 0x97, 0xa1, 0x0f, 0xd4, 0x34, 0xe0, 0x15, }, + { 0xb4, 0xa3, 0x15, 0x08, 0xbe, 0xff, 0x4d, 0x31, }, + { 0x81, 0x39, 0x62, 0x29, 0xf0, 0x90, 0x79, 0x02, }, + { 0x4d, 0x0c, 0xf4, 0x9e, 0xe5, 0xd4, 0xdc, 0xca, }, + { 0x5c, 0x73, 0x33, 0x6a, 0x76, 0xd8, 0xbf, 0x9a, }, + { 0xd0, 0xa7, 0x04, 0x53, 0x6b, 0xa9, 0x3e, 0x0e, }, + { 0x92, 0x59, 0x58, 0xfc, 0xd6, 0x42, 0x0c, 0xad, }, + { 0xa9, 0x15, 0xc2, 0x9b, 0xc8, 0x06, 0x73, 0x18, }, + { 0x95, 0x2b, 0x79, 0xf3, 0xbc, 0x0a, 0xa6, 0xd4, }, + { 0xf2, 0x1d, 0xf2, 0xe4, 0x1d, 0x45, 0x35, 0xf9, }, + { 0x87, 0x57, 0x75, 0x19, 0x04, 0x8f, 0x53, 0xa9, }, + { 0x10, 0xa5, 0x6c, 0xf5, 0xdf, 0xcd, 0x9a, 0xdb, }, + { 0xeb, 0x75, 0x09, 0x5c, 0xcd, 0x98, 0x6c, 0xd0, }, + { 0x51, 0xa9, 0xcb, 0x9e, 0xcb, 0xa3, 0x12, 0xe6, }, + { 0x96, 0xaf, 0xad, 0xfc, 0x2c, 0xe6, 0x66, 0xc7, }, + { 0x72, 0xfe, 0x52, 0x97, 0x5a, 0x43, 0x64, 0xee, }, + { 0x5a, 0x16, 0x45, 0xb2, 0x76, 0xd5, 0x92, 0xa1, }, + { 0xb2, 0x74, 0xcb, 0x8e, 0xbf, 0x87, 0x87, 0x0a, }, + { 0x6f, 0x9b, 0xb4, 0x20, 0x3d, 0xe7, 0xb3, 0x81, }, + { 0xea, 0xec, 0xb2, 0xa3, 0x0b, 0x22, 0xa8, 0x7f, }, + { 0x99, 0x24, 0xa4, 0x3c, 0xc1, 0x31, 0x57, 0x24, }, + { 0xbd, 0x83, 0x8d, 0x3a, 0xaf, 0xbf, 0x8d, 0xb7, }, + { 0x0b, 0x1a, 0x2a, 0x32, 0x65, 0xd5, 0x1a, 0xea, }, + { 0x13, 0x50, 0x79, 0xa3, 0x23, 0x1c, 0xe6, 0x60, }, + { 0x93, 0x2b, 0x28, 0x46, 0xe4, 0xd7, 0x06, 0x66, }, + { 0xe1, 0x91, 0x5f, 0x5c, 0xb1, 0xec, 0xa4, 0x6c, }, + { 0xf3, 0x25, 0x96, 0x5c, 0xa1, 0x6d, 0x62, 0x9f, }, + { 0x57, 0x5f, 0xf2, 0x8e, 0x60, 0x38, 0x1b, 0xe5, }, + { 0x72, 0x45, 0x06, 0xeb, 0x4c, 0x32, 0x8a, 0x95, } + }; + /* clang-format on */ + + unsigned char in[64]; + struct sipkey k; + size_t i; + + sip_tokey(&k, "\000\001\002\003\004\005\006\007\010\011" + "\012\013\014\015\016\017"); + + for (i = 0; i < sizeof in; ++i) { + in[i] = (unsigned char)i; + + if (siphash24(in, i, &k) != SIP_U8TO64_LE(vectors[i])) + return 0; + } + + return 1; +} /* sip24_valid() */ + +#ifdef SIPHASH_MAIN + +# include + +int +main(void) { + const int ok = sip24_valid(); + + if (ok) + puts("OK"); + else + puts("FAIL"); + + return ! ok; +} /* main() */ + +#endif /* SIPHASH_MAIN */ + +#endif /* SIPHASH_H */ diff --git a/deps/EXPAT/expat/utf8tab.h b/deps/EXPAT/expat/utf8tab.h index 7bb3e7760..88efcf91c 100644 --- a/deps/EXPAT/expat/utf8tab.h +++ b/deps/EXPAT/expat/utf8tab.h @@ -1,37 +1,66 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2017 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ - /* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, -/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, + /* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, + /* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, + /* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, + /* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, + /* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, + /* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, + /* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, + /* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, + /* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, + /* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, + /* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, + /* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, + /* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, + /* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, + /* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, + /* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, diff --git a/deps/EXPAT/expat/xmlparse.c b/deps/EXPAT/expat/xmlparse.c index fbe5e0200..803a1674d 100644 --- a/deps/EXPAT/expat/xmlparse.c +++ b/deps/EXPAT/expat/xmlparse.c @@ -1,84 +1,196 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* 5ab094ffadd6edfc94c3eee53af44a86951f9f1f0933ada3114bbce2bfb02c99 (2.5.0+) + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2000-2006 Fred L. Drake, Jr. + Copyright (c) 2001-2002 Greg Stein + Copyright (c) 2002-2016 Karl Waclawek + Copyright (c) 2005-2009 Steven Solie + Copyright (c) 2016 Eric Rahm + Copyright (c) 2016-2022 Sebastian Pipping + Copyright (c) 2016 Gaurav + Copyright (c) 2016 Thomas Beutlich + Copyright (c) 2016 Gustavo Grieco + Copyright (c) 2016 Pascal Cuoq + Copyright (c) 2016 Ed Schouten + Copyright (c) 2017-2022 Rhodri James + Copyright (c) 2017 Václav Slavík + Copyright (c) 2017 Viktor Szakats + Copyright (c) 2017 Chanho Park + Copyright (c) 2017 Rolf Eike Beer + Copyright (c) 2017 Hans Wennborg + Copyright (c) 2018 Anton Maklakov + Copyright (c) 2018 Benjamin Peterson + Copyright (c) 2018 Marco Maggi + Copyright (c) 2018 Mariusz Zaborski + Copyright (c) 2019 David Loffredo + Copyright (c) 2019-2020 Ben Wagner + Copyright (c) 2019 Vadim Zeitlin + Copyright (c) 2021 Dong-hee Na + Copyright (c) 2022 Samanta Navarro + Copyright (c) 2022 Jeffrey Walton + Copyright (c) 2022 Jann Horn + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include -#include /* memset(), memcpy() */ -#include -#include /* UINT_MAX */ - -#ifdef WIN32 -#define getpid GetCurrentProcessId -#else -#include /* gettimeofday() */ -#include /* getpid() */ -#include /* getpid() */ -#endif - #define XML_BUILDING_EXPAT 1 +#if ! defined(_GNU_SOURCE) +# define _GNU_SOURCE 1 /* syscall prototype */ +#endif + +#ifdef _WIN32 +/* force stdlib to define rand_s() */ +# if ! defined(_CRT_RAND_S) +# define _CRT_RAND_S +# endif +#endif + +#include +#include /* memset(), memcpy() */ +#include +#include /* UINT_MAX */ +#include /* fprintf */ +#include /* getenv, rand_s */ +#include /* uintptr_t */ +#include /* isnan */ + +#ifdef _WIN32 +# define getpid GetCurrentProcessId +#else +# include /* gettimeofday() */ +# include /* getpid() */ +# include /* getpid() */ +# include /* O_RDONLY */ +# include +#endif + #include "expat_config.h" + #include "ascii.h" #include "expat.h" +#include "siphash.h" + +#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) +# if defined(HAVE_GETRANDOM) +# include /* getrandom */ +# else +# include /* syscall */ +# include /* SYS_getrandom */ +# endif +# if ! defined(GRND_NONBLOCK) +# define GRND_NONBLOCK 0x0001 +# endif /* defined(GRND_NONBLOCK) */ +#endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */ + +#if defined(HAVE_LIBBSD) \ + && (defined(HAVE_ARC4RANDOM_BUF) || defined(HAVE_ARC4RANDOM)) +# include +#endif + +#if defined(_WIN32) && ! defined(LOAD_LIBRARY_SEARCH_SYSTEM32) +# define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 +#endif + +#if ! defined(HAVE_GETRANDOM) && ! defined(HAVE_SYSCALL_GETRANDOM) \ + && ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) \ + && ! defined(XML_DEV_URANDOM) && ! defined(_WIN32) \ + && ! defined(XML_POOR_ENTROPY) +# error You do not have support for any sources of high quality entropy \ + enabled. For end user security, that is probably not what you want. \ + \ + Your options include: \ + * Linux >=3.17 + glibc >=2.25 (getrandom): HAVE_GETRANDOM, \ + * Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \ + * BSD / macOS >=10.7 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \ + * BSD / macOS (including <10.7) (arc4random): HAVE_ARC4RANDOM, \ + * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, \ + * libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, \ + * Linux (including <3.17) / BSD / macOS (including <10.7) / Solaris >=8 (/dev/urandom): XML_DEV_URANDOM, \ + * Windows >=Vista (rand_s): _WIN32. \ + \ + If insist on not using any of these, bypass this error by defining \ + XML_POOR_ENTROPY; you have been warned. \ + \ + If you have reasons to patch this detection code away or need changes \ + to the build system, please open a bug. Thank you! +#endif #ifdef XML_UNICODE -#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX -#define XmlConvert XmlUtf16Convert -#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS -#define XmlEncode XmlUtf16Encode -/* Using pointer subtraction to convert to integer type. */ -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1)) +# define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX +# define XmlConvert XmlUtf16Convert +# define XmlGetInternalEncoding XmlGetUtf16InternalEncoding +# define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS +# define XmlEncode XmlUtf16Encode +# define MUST_CONVERT(enc, s) (! (enc)->isUtf16 || (((uintptr_t)(s)) & 1)) typedef unsigned short ICHAR; #else -#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX -#define XmlConvert XmlUtf8Convert -#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS -#define XmlEncode XmlUtf8Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf8) +# define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX +# define XmlConvert XmlUtf8Convert +# define XmlGetInternalEncoding XmlGetUtf8InternalEncoding +# define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS +# define XmlEncode XmlUtf8Encode +# define MUST_CONVERT(enc, s) (! (enc)->isUtf8) typedef char ICHAR; #endif - #ifndef XML_NS -#define XmlInitEncodingNS XmlInitEncoding -#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding -#undef XmlGetInternalEncodingNS -#define XmlGetInternalEncodingNS XmlGetInternalEncoding -#define XmlParseXmlDeclNS XmlParseXmlDecl +# define XmlInitEncodingNS XmlInitEncoding +# define XmlInitUnknownEncodingNS XmlInitUnknownEncoding +# undef XmlGetInternalEncodingNS +# define XmlGetInternalEncodingNS XmlGetInternalEncoding +# define XmlParseXmlDeclNS XmlParseXmlDecl #endif #ifdef XML_UNICODE -#ifdef XML_UNICODE_WCHAR_T -#define XML_T(x) (const wchar_t)x -#define XML_L(x) L ## x -#else -#define XML_T(x) (const unsigned short)x -#define XML_L(x) x -#endif +# ifdef XML_UNICODE_WCHAR_T +# define XML_T(x) (const wchar_t) x +# define XML_L(x) L##x +# else +# define XML_T(x) (const unsigned short)x +# define XML_L(x) x +# endif #else -#define XML_T(x) x -#define XML_L(x) x +# define XML_T(x) x +# define XML_L(x) x #endif /* Round up n to be a multiple of sz, where sz is a power of 2. */ -#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) +#define ROUND_UP(n, sz) (((n) + ((sz)-1)) & ~((sz)-1)) -/* Handle the case where memmove() doesn't exist. */ -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#error memmove does not exist on this platform, nor is a substitute available -#endif /* HAVE_BCOPY */ -#endif /* HAVE_MEMMOVE */ +/* Do safe (NULL-aware) pointer arithmetic */ +#define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0) #include "internal.h" #include "xmltok.h" @@ -98,17 +210,9 @@ typedef struct { const XML_Memory_Handling_Suite *mem; } HASH_TABLE; -/* Basic character hash algorithm, taken from Python's string hash: - h = h * 1000003 ^ character, the constant being a prime number. +static size_t keylen(KEY s); -*/ -#ifdef XML_UNICODE -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned short)(c)) -#else -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned char)(c)) -#endif +static void copy_salt_to_sipkey(XML_Parser parser, struct sipkey *key); /* For probing (after a collision) we need a step size relative prime to the hash table size, which is a power of 2. We use double-hashing, @@ -118,9 +222,9 @@ typedef struct { We limit the maximum step size to table->size / 4 (mask >> 2) and make it odd, since odd numbers are always relative prime to a power of 2. */ -#define SECOND_HASH(hash, mask, power) \ - ((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2)) -#define PROBE_STEP(hash, mask, power) \ +#define SECOND_HASH(hash, mask, power) \ + ((((hash) & ~(mask)) >> ((power)-1)) & ((mask) >> 2)) +#define PROBE_STEP(hash, mask, power) \ ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1)) typedef struct { @@ -128,7 +232,7 @@ typedef struct { NAMED **end; } HASH_TABLE_ITER; -#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ +#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ #define INIT_DATA_BUF_SIZE 1024 #define INIT_ATTS_SIZE 16 #define INIT_ATTS_VERSION 0xFFFFFFFF @@ -175,20 +279,20 @@ typedef struct { TAG objects in a free list. */ typedef struct tag { - struct tag *parent; /* parent of this element */ - const char *rawName; /* tagName in the original encoding */ + struct tag *parent; /* parent of this element */ + const char *rawName; /* tagName in the original encoding */ int rawNameLength; - TAG_NAME name; /* tagName in the API encoding */ - char *buf; /* buffer for name components */ - char *bufEnd; /* end of the buffer */ + TAG_NAME name; /* tagName in the API encoding */ + char *buf; /* buffer for name components */ + char *bufEnd; /* end of the buffer */ BINDING *bindings; } TAG; typedef struct { const XML_Char *name; const XML_Char *textPtr; - int textLen; /* length in XML_Chars */ - int processed; /* # of processed bytes - when suspended */ + int textLen; /* length in XML_Chars */ + int processed; /* # of processed bytes - when suspended */ const XML_Char *systemId; const XML_Char *base; const XML_Char *publicId; @@ -199,13 +303,13 @@ typedef struct { } ENTITY; typedef struct { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - const XML_Char * name; - int firstchild; - int lastchild; - int childcnt; - int nextsib; + enum XML_Content_Type type; + enum XML_Content_Quant quant; + const XML_Char *name; + int firstchild; + int lastchild; + int childcnt; + int nextsib; } CONTENT_SCAFFOLD; #define INIT_SCAFFOLD_ELEMENTS 32 @@ -293,10 +397,33 @@ typedef struct open_internal_entity { XML_Bool betweenDecl; /* WFC: PE Between Declarations */ } OPEN_INTERNAL_ENTITY; -typedef enum XML_Error PTRCALL Processor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr); +enum XML_Account { + XML_ACCOUNT_DIRECT, /* bytes directly passed to the Expat parser */ + XML_ACCOUNT_ENTITY_EXPANSION, /* intermediate bytes produced during entity + expansion */ + XML_ACCOUNT_NONE /* i.e. do not account, was accounted already */ +}; + +#ifdef XML_DTD +typedef unsigned long long XmlBigCount; +typedef struct accounting { + XmlBigCount countBytesDirect; + XmlBigCount countBytesIndirect; + int debugLevel; + float maximumAmplificationFactor; // >=1.0 + unsigned long long activationThresholdBytes; +} ACCOUNTING; + +typedef struct entity_stats { + unsigned int countEverOpened; + unsigned int currentDepth; + unsigned int maximumDepthSeen; + int debugLevel; +} ENTITY_STATS; +#endif /* XML_DTD */ + +typedef enum XML_Error PTRCALL Processor(XML_Parser parser, const char *start, + const char *end, const char **endPtr); static Processor prologProcessor; static Processor prologInitProcessor; @@ -317,128 +444,147 @@ static Processor externalEntityInitProcessor3; static Processor externalEntityContentProcessor; static Processor internalEntityProcessor; -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next); -static enum XML_Error -initializeEncoding(XML_Parser parser); -static enum XML_Error -doProlog(XML_Parser parser, const ENCODING *enc, const char *s, - const char *end, int tok, const char *next, const char **nextPtr, - XML_Bool haveMore); -static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, - XML_Bool betweenDecl); -static enum XML_Error -doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, - const char *start, const char *end, const char **endPtr, - XML_Bool haveMore); -static enum XML_Error -doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr, XML_Bool haveMore); +static enum XML_Error handleUnknownEncoding(XML_Parser parser, + const XML_Char *encodingName); +static enum XML_Error processXmlDecl(XML_Parser parser, int isGeneralTextEntity, + const char *s, const char *next); +static enum XML_Error initializeEncoding(XML_Parser parser); +static enum XML_Error doProlog(XML_Parser parser, const ENCODING *enc, + const char *s, const char *end, int tok, + const char *next, const char **nextPtr, + XML_Bool haveMore, XML_Bool allowClosingDoctype, + enum XML_Account account); +static enum XML_Error processInternalEntity(XML_Parser parser, ENTITY *entity, + XML_Bool betweenDecl); +static enum XML_Error doContent(XML_Parser parser, int startTagLevel, + const ENCODING *enc, const char *start, + const char *end, const char **endPtr, + XML_Bool haveMore, enum XML_Account account); +static enum XML_Error doCdataSection(XML_Parser parser, const ENCODING *, + const char **startPtr, const char *end, + const char **nextPtr, XML_Bool haveMore, + enum XML_Account account); #ifdef XML_DTD -static enum XML_Error -doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr, XML_Bool haveMore); +static enum XML_Error doIgnoreSection(XML_Parser parser, const ENCODING *, + const char **startPtr, const char *end, + const char **nextPtr, XML_Bool haveMore); #endif /* XML_DTD */ -static enum XML_Error -storeAtts(XML_Parser parser, const ENCODING *, const char *s, - TAG_NAME *tagNamePtr, BINDING **bindingsPtr); -static enum XML_Error -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr); -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, - XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser); -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); -static enum XML_Error -storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end); -static int -reportComment(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static void -reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); +static void freeBindings(XML_Parser parser, BINDING *bindings); +static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, + const char *s, TAG_NAME *tagNamePtr, + BINDING **bindingsPtr, + enum XML_Account account); +static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix, + const ATTRIBUTE_ID *attId, const XML_Char *uri, + BINDING **bindingsPtr); +static int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, + XML_Bool isId, const XML_Char *dfltValue, + XML_Parser parser); +static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *, + XML_Bool isCdata, const char *, + const char *, STRING_POOL *, + enum XML_Account account); +static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *, + XML_Bool isCdata, const char *, + const char *, STRING_POOL *, + enum XML_Account account); +static ATTRIBUTE_ID *getAttributeId(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end); +static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); +static enum XML_Error storeEntityValue(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end, + enum XML_Account account); +static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end); +static int reportComment(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end); +static void reportDefault(XML_Parser parser, const ENCODING *enc, + const char *start, const char *end); -static const XML_Char * getContext(XML_Parser parser); -static XML_Bool -setContext(XML_Parser parser, const XML_Char *context); +static const XML_Char *getContext(XML_Parser parser); +static XML_Bool setContext(XML_Parser parser, const XML_Char *context); static void FASTCALL normalizePublicId(XML_Char *s); -static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms); -/* do not call if parentParser != NULL */ +static DTD *dtdCreate(const XML_Memory_Handling_Suite *ms); +/* do not call if m_parentParser != NULL */ static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms); -static void -dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms); -static int -dtdCopy(XML_Parser oldParser, - DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms); -static int -copyEntityTable(XML_Parser oldParser, - HASH_TABLE *, STRING_POOL *, const HASH_TABLE *); -static NAMED * -lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize); -static void FASTCALL -hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms); +static void dtdDestroy(DTD *p, XML_Bool isDocEntity, + const XML_Memory_Handling_Suite *ms); +static int dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, + const XML_Memory_Handling_Suite *ms); +static int copyEntityTable(XML_Parser oldParser, HASH_TABLE *, STRING_POOL *, + const HASH_TABLE *); +static NAMED *lookup(XML_Parser parser, HASH_TABLE *table, KEY name, + size_t createSize); +static void FASTCALL hashTableInit(HASH_TABLE *, + const XML_Memory_Handling_Suite *ms); static void FASTCALL hashTableClear(HASH_TABLE *); static void FASTCALL hashTableDestroy(HASH_TABLE *); -static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); -static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *); +static void FASTCALL hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); +static NAMED *FASTCALL hashTableIterNext(HASH_TABLE_ITER *); -static void FASTCALL -poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms); +static void FASTCALL poolInit(STRING_POOL *, + const XML_Memory_Handling_Suite *ms); static void FASTCALL poolClear(STRING_POOL *); static void FASTCALL poolDestroy(STRING_POOL *); -static XML_Char * -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Char * -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); +static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end); +static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc, + const char *ptr, const char *end); static XML_Bool FASTCALL poolGrow(STRING_POOL *pool); -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s); -static const XML_Char * -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s); +static const XML_Char *FASTCALL poolCopyString(STRING_POOL *pool, + const XML_Char *s); +static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, + int n); +static const XML_Char *FASTCALL poolAppendString(STRING_POOL *pool, + const XML_Char *s); static int FASTCALL nextScaffoldPart(XML_Parser parser); -static XML_Content * build_model(XML_Parser parser); -static ELEMENT_TYPE * -getElementType(XML_Parser parser, const ENCODING *enc, - const char *ptr, const char *end); +static XML_Content *build_model(XML_Parser parser); +static ELEMENT_TYPE *getElementType(XML_Parser parser, const ENCODING *enc, + const char *ptr, const char *end); + +static XML_Char *copyString(const XML_Char *s, + const XML_Memory_Handling_Suite *memsuite); static unsigned long generate_hash_secret_salt(XML_Parser parser); static XML_Bool startParsing(XML_Parser parser); -static XML_Parser -parserCreate(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep, - DTD *dtd); +static XML_Parser parserCreate(const XML_Char *encodingName, + const XML_Memory_Handling_Suite *memsuite, + const XML_Char *nameSep, DTD *dtd); -static void -parserInit(XML_Parser parser, const XML_Char *encodingName); +static void parserInit(XML_Parser parser, const XML_Char *encodingName); + +#ifdef XML_DTD +static float accountingGetCurrentAmplification(XML_Parser rootParser); +static void accountingReportStats(XML_Parser originParser, const char *epilog); +static void accountingOnAbort(XML_Parser originParser); +static void accountingReportDiff(XML_Parser rootParser, + unsigned int levelsAwayFromRootParser, + const char *before, const char *after, + ptrdiff_t bytesMore, int source_line, + enum XML_Account account); +static XML_Bool accountingDiffTolerated(XML_Parser originParser, int tok, + const char *before, const char *after, + int source_line, + enum XML_Account account); + +static void entityTrackingReportStats(XML_Parser parser, ENTITY *entity, + const char *action, int sourceLine); +static void entityTrackingOnOpen(XML_Parser parser, ENTITY *entity, + int sourceLine); +static void entityTrackingOnClose(XML_Parser parser, ENTITY *entity, + int sourceLine); + +static XML_Parser getRootParserOf(XML_Parser parser, + unsigned int *outLevelDiff); +#endif /* XML_DTD */ + +static unsigned long getDebugLevel(const char *variableName, + unsigned long defaultDebugLevel); #define poolStart(pool) ((pool)->start) #define poolEnd(pool) ((pool)->ptr) @@ -447,13 +593,13 @@ parserInit(XML_Parser parser, const XML_Char *encodingName); #define poolLastChar(pool) (((pool)->ptr)[-1]) #define poolDiscard(pool) ((pool)->ptr = (pool)->start) #define poolFinish(pool) ((pool)->start = (pool)->ptr) -#define poolAppendChar(pool, c) \ - (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ - ? 0 \ - : ((*((pool)->ptr)++ = c), 1)) +#define poolAppendChar(pool, c) \ + (((pool)->ptr == (pool)->end && ! poolGrow(pool)) \ + ? 0 \ + : ((*((pool)->ptr)++ = c), 1)) struct XML_ParserStruct { - /* The first member must be userData so that the XML_GetUserData + /* The first member must be m_userData so that the XML_GetUserData macro works. */ void *m_userData; void *m_handlerArg; @@ -463,7 +609,7 @@ struct XML_ParserStruct { const char *m_bufferPtr; /* past last character to be parsed */ char *m_bufferEnd; - /* allocated end of buffer */ + /* allocated end of m_buffer */ const char *m_bufferLim; XML_Index m_parseEndByteIndex; const char *m_parseEndPtr; @@ -501,7 +647,7 @@ struct XML_ParserStruct { void *m_unknownEncodingMem; void *m_unknownEncodingData; void *m_unknownEncodingHandlerData; - void (XMLCALL *m_unknownEncodingRelease)(void *); + void(XMLCALL *m_unknownEncodingRelease)(void *); PROLOG_STATE m_prologState; Processor *m_processor; enum XML_Error m_errorCode; @@ -553,220 +699,288 @@ struct XML_ParserStruct { enum XML_ParamEntityParsing m_paramEntityParsing; #endif unsigned long m_hash_secret_salt; +#ifdef XML_DTD + ACCOUNTING m_accounting; + ENTITY_STATS m_entity_stats; +#endif }; -#define MALLOC(s) (parser->m_mem.malloc_fcn((s))) -#define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s))) -#define FREE(p) (parser->m_mem.free_fcn((p))) - -#define userData (parser->m_userData) -#define handlerArg (parser->m_handlerArg) -#define startElementHandler (parser->m_startElementHandler) -#define endElementHandler (parser->m_endElementHandler) -#define characterDataHandler (parser->m_characterDataHandler) -#define processingInstructionHandler \ - (parser->m_processingInstructionHandler) -#define commentHandler (parser->m_commentHandler) -#define startCdataSectionHandler \ - (parser->m_startCdataSectionHandler) -#define endCdataSectionHandler (parser->m_endCdataSectionHandler) -#define defaultHandler (parser->m_defaultHandler) -#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler) -#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler) -#define unparsedEntityDeclHandler \ - (parser->m_unparsedEntityDeclHandler) -#define notationDeclHandler (parser->m_notationDeclHandler) -#define startNamespaceDeclHandler \ - (parser->m_startNamespaceDeclHandler) -#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler) -#define notStandaloneHandler (parser->m_notStandaloneHandler) -#define externalEntityRefHandler \ - (parser->m_externalEntityRefHandler) -#define externalEntityRefHandlerArg \ - (parser->m_externalEntityRefHandlerArg) -#define internalEntityRefHandler \ - (parser->m_internalEntityRefHandler) -#define skippedEntityHandler (parser->m_skippedEntityHandler) -#define unknownEncodingHandler (parser->m_unknownEncodingHandler) -#define elementDeclHandler (parser->m_elementDeclHandler) -#define attlistDeclHandler (parser->m_attlistDeclHandler) -#define entityDeclHandler (parser->m_entityDeclHandler) -#define xmlDeclHandler (parser->m_xmlDeclHandler) -#define encoding (parser->m_encoding) -#define initEncoding (parser->m_initEncoding) -#define internalEncoding (parser->m_internalEncoding) -#define unknownEncodingMem (parser->m_unknownEncodingMem) -#define unknownEncodingData (parser->m_unknownEncodingData) -#define unknownEncodingHandlerData \ - (parser->m_unknownEncodingHandlerData) -#define unknownEncodingRelease (parser->m_unknownEncodingRelease) -#define protocolEncodingName (parser->m_protocolEncodingName) -#define ns (parser->m_ns) -#define ns_triplets (parser->m_ns_triplets) -#define prologState (parser->m_prologState) -#define processor (parser->m_processor) -#define errorCode (parser->m_errorCode) -#define eventPtr (parser->m_eventPtr) -#define eventEndPtr (parser->m_eventEndPtr) -#define positionPtr (parser->m_positionPtr) -#define position (parser->m_position) -#define openInternalEntities (parser->m_openInternalEntities) -#define freeInternalEntities (parser->m_freeInternalEntities) -#define defaultExpandInternalEntities \ - (parser->m_defaultExpandInternalEntities) -#define tagLevel (parser->m_tagLevel) -#define buffer (parser->m_buffer) -#define bufferPtr (parser->m_bufferPtr) -#define bufferEnd (parser->m_bufferEnd) -#define parseEndByteIndex (parser->m_parseEndByteIndex) -#define parseEndPtr (parser->m_parseEndPtr) -#define bufferLim (parser->m_bufferLim) -#define dataBuf (parser->m_dataBuf) -#define dataBufEnd (parser->m_dataBufEnd) -#define _dtd (parser->m_dtd) -#define curBase (parser->m_curBase) -#define declEntity (parser->m_declEntity) -#define doctypeName (parser->m_doctypeName) -#define doctypeSysid (parser->m_doctypeSysid) -#define doctypePubid (parser->m_doctypePubid) -#define declAttributeType (parser->m_declAttributeType) -#define declNotationName (parser->m_declNotationName) -#define declNotationPublicId (parser->m_declNotationPublicId) -#define declElementType (parser->m_declElementType) -#define declAttributeId (parser->m_declAttributeId) -#define declAttributeIsCdata (parser->m_declAttributeIsCdata) -#define declAttributeIsId (parser->m_declAttributeIsId) -#define freeTagList (parser->m_freeTagList) -#define freeBindingList (parser->m_freeBindingList) -#define inheritedBindings (parser->m_inheritedBindings) -#define tagStack (parser->m_tagStack) -#define atts (parser->m_atts) -#define attsSize (parser->m_attsSize) -#define nSpecifiedAtts (parser->m_nSpecifiedAtts) -#define idAttIndex (parser->m_idAttIndex) -#define nsAtts (parser->m_nsAtts) -#define nsAttsVersion (parser->m_nsAttsVersion) -#define nsAttsPower (parser->m_nsAttsPower) -#define attInfo (parser->m_attInfo) -#define tempPool (parser->m_tempPool) -#define temp2Pool (parser->m_temp2Pool) -#define groupConnector (parser->m_groupConnector) -#define groupSize (parser->m_groupSize) -#define namespaceSeparator (parser->m_namespaceSeparator) -#define parentParser (parser->m_parentParser) -#define ps_parsing (parser->m_parsingStatus.parsing) -#define ps_finalBuffer (parser->m_parsingStatus.finalBuffer) -#ifdef XML_DTD -#define isParamEntity (parser->m_isParamEntity) -#define useForeignDTD (parser->m_useForeignDTD) -#define paramEntityParsing (parser->m_paramEntityParsing) -#endif /* XML_DTD */ -#define hash_secret_salt (parser->m_hash_secret_salt) +#define MALLOC(parser, s) (parser->m_mem.malloc_fcn((s))) +#define REALLOC(parser, p, s) (parser->m_mem.realloc_fcn((p), (s))) +#define FREE(parser, p) (parser->m_mem.free_fcn((p))) XML_Parser XMLCALL -XML_ParserCreate(const XML_Char *encodingName) -{ +XML_ParserCreate(const XML_Char *encodingName) { return XML_ParserCreate_MM(encodingName, NULL, NULL); } XML_Parser XMLCALL -XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) -{ - XML_Char tmp[2]; - *tmp = nsSep; +XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) { + XML_Char tmp[2] = {nsSep, 0}; return XML_ParserCreate_MM(encodingName, NULL, tmp); } -static const XML_Char implicitContext[] = { - ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p, - ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, - ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g, - ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9, - ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e, - ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' -}; +// "xml=http://www.w3.org/XML/1998/namespace" +static const XML_Char implicitContext[] + = {ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, + ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, + ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, + ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, + ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, + ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, + ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e, + ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, + '\0'}; + +/* To avoid warnings about unused functions: */ +#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) + +# if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) + +/* Obtain entropy on Linux 3.17+ */ +static int +writeRandomBytes_getrandom_nonblock(void *target, size_t count) { + int success = 0; /* full count bytes written? */ + size_t bytesWrittenTotal = 0; + const unsigned int getrandomFlags = GRND_NONBLOCK; + + do { + void *const currentTarget = (void *)((char *)target + bytesWrittenTotal); + const size_t bytesToWrite = count - bytesWrittenTotal; + + const int bytesWrittenMore = +# if defined(HAVE_GETRANDOM) + getrandom(currentTarget, bytesToWrite, getrandomFlags); +# else + syscall(SYS_getrandom, currentTarget, bytesToWrite, getrandomFlags); +# endif + + if (bytesWrittenMore > 0) { + bytesWrittenTotal += bytesWrittenMore; + if (bytesWrittenTotal >= count) + success = 1; + } + } while (! success && (errno == EINTR)); + + return success; +} + +# endif /* defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) */ + +# if ! defined(_WIN32) && defined(XML_DEV_URANDOM) + +/* Extract entropy from /dev/urandom */ +static int +writeRandomBytes_dev_urandom(void *target, size_t count) { + int success = 0; /* full count bytes written? */ + size_t bytesWrittenTotal = 0; + + const int fd = open("/dev/urandom", O_RDONLY); + if (fd < 0) { + return 0; + } + + do { + void *const currentTarget = (void *)((char *)target + bytesWrittenTotal); + const size_t bytesToWrite = count - bytesWrittenTotal; + + const ssize_t bytesWrittenMore = read(fd, currentTarget, bytesToWrite); + + if (bytesWrittenMore > 0) { + bytesWrittenTotal += bytesWrittenMore; + if (bytesWrittenTotal >= count) + success = 1; + } + } while (! success && (errno == EINTR)); + + close(fd); + return success; +} + +# endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */ + +#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */ + +#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) + +static void +writeRandomBytes_arc4random(void *target, size_t count) { + size_t bytesWrittenTotal = 0; + + while (bytesWrittenTotal < count) { + const uint32_t random32 = arc4random(); + size_t i = 0; + + for (; (i < sizeof(random32)) && (bytesWrittenTotal < count); + i++, bytesWrittenTotal++) { + const uint8_t random8 = (uint8_t)(random32 >> (i * 8)); + ((uint8_t *)target)[bytesWrittenTotal] = random8; + } + } +} + +#endif /* defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) */ + +#ifdef _WIN32 + +/* Provide declaration of rand_s() for MinGW-32 (not 64, which has it), + as it didn't declare it in its header prior to version 5.3.0 of its + runtime package (mingwrt, containing stdlib.h). The upstream fix + was introduced at https://osdn.net/projects/mingw/ticket/39658 . */ +# if defined(__MINGW32__) && defined(__MINGW32_VERSION) \ + && __MINGW32_VERSION < 5003000L && ! defined(__MINGW64_VERSION_MAJOR) +__declspec(dllimport) int rand_s(unsigned int *); +# endif + +/* Obtain entropy on Windows using the rand_s() function which + * generates cryptographically secure random numbers. Internally it + * uses RtlGenRandom API which is present in Windows XP and later. + */ +static int +writeRandomBytes_rand_s(void *target, size_t count) { + size_t bytesWrittenTotal = 0; + + while (bytesWrittenTotal < count) { + unsigned int random32 = 0; + size_t i = 0; + + if (rand_s(&random32)) + return 0; /* failure */ + + for (; (i < sizeof(random32)) && (bytesWrittenTotal < count); + i++, bytesWrittenTotal++) { + const uint8_t random8 = (uint8_t)(random32 >> (i * 8)); + ((uint8_t *)target)[bytesWrittenTotal] = random8; + } + } + return 1; /* success */ +} + +#endif /* _WIN32 */ + +#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) static unsigned long -gather_time_entropy(void) -{ -#ifdef WIN32 +gather_time_entropy(void) { +# ifdef _WIN32 FILETIME ft; GetSystemTimeAsFileTime(&ft); /* never fails */ return ft.dwHighDateTime ^ ft.dwLowDateTime; -#else +# else struct timeval tv; int gettimeofday_res; gettimeofday_res = gettimeofday(&tv, NULL); - assert (gettimeofday_res == 0); + +# if defined(NDEBUG) + (void)gettimeofday_res; +# else + assert(gettimeofday_res == 0); +# endif /* defined(NDEBUG) */ /* Microseconds time is <20 bits entropy */ return tv.tv_usec; +# endif +} + +#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */ + +static unsigned long +ENTROPY_DEBUG(const char *label, unsigned long entropy) { + if (getDebugLevel("EXPAT_ENTROPY_DEBUG", 0) >= 1u) { + fprintf(stderr, "expat: Entropy: %s --> 0x%0*lx (%lu bytes)\n", label, + (int)sizeof(entropy) * 2, entropy, (unsigned long)sizeof(entropy)); + } + return entropy; +} + +static unsigned long +generate_hash_secret_salt(XML_Parser parser) { + unsigned long entropy; + (void)parser; + + /* "Failproof" high quality providers: */ +#if defined(HAVE_ARC4RANDOM_BUF) + arc4random_buf(&entropy, sizeof(entropy)); + return ENTROPY_DEBUG("arc4random_buf", entropy); +#elif defined(HAVE_ARC4RANDOM) + writeRandomBytes_arc4random((void *)&entropy, sizeof(entropy)); + return ENTROPY_DEBUG("arc4random", entropy); +#else + /* Try high quality providers first .. */ +# ifdef _WIN32 + if (writeRandomBytes_rand_s((void *)&entropy, sizeof(entropy))) { + return ENTROPY_DEBUG("rand_s", entropy); + } +# elif defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM) + if (writeRandomBytes_getrandom_nonblock((void *)&entropy, sizeof(entropy))) { + return ENTROPY_DEBUG("getrandom", entropy); + } +# endif +# if ! defined(_WIN32) && defined(XML_DEV_URANDOM) + if (writeRandomBytes_dev_urandom((void *)&entropy, sizeof(entropy))) { + return ENTROPY_DEBUG("/dev/urandom", entropy); + } +# endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */ + /* .. and self-made low quality for backup: */ + + /* Process ID is 0 bits entropy if attacker has local access */ + entropy = gather_time_entropy() ^ getpid(); + + /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */ + if (sizeof(unsigned long) == 4) { + return ENTROPY_DEBUG("fallback(4)", entropy * 2147483647); + } else { + return ENTROPY_DEBUG("fallback(8)", + entropy * (unsigned long)2305843009213693951ULL); + } #endif } static unsigned long -generate_hash_secret_salt(XML_Parser parser) -{ - /* Process ID is 0 bits entropy if attacker has local access - * XML_Parser address is few bits of entropy if attacker has local access */ - // Prusa3D specific: Fix for a following warning, which turns to an error on some Perl/XS installations: - // error: cast from 'XML_Parser' to 'long unsigned int' loses precision [-fpermissive] - unsigned long *parser_addr = (unsigned long*)&parser; - const unsigned long entropy = - gather_time_entropy() ^ getpid() ^ *parser_addr; - - /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */ - if (sizeof(unsigned long) == 4) { - return entropy * 2147483647; - } else { - return entropy * (unsigned long)2305843009213693951; - } +get_hash_secret_salt(XML_Parser parser) { + if (parser->m_parentParser != NULL) + return get_hash_secret_salt(parser->m_parentParser); + return parser->m_hash_secret_salt; } -static XML_Bool /* only valid for root parser */ -startParsing(XML_Parser parser) -{ - /* hash functions must be initialized before setContext() is called */ - if (hash_secret_salt == 0) - hash_secret_salt = generate_hash_secret_salt(parser); - if (ns) { - /* implicit context only set for root parser, since child - parsers (i.e. external entity parsers) will inherit it - */ - return setContext(parser, implicitContext); - } - return XML_TRUE; +static XML_Bool /* only valid for root parser */ +startParsing(XML_Parser parser) { + /* hash functions must be initialized before setContext() is called */ + if (parser->m_hash_secret_salt == 0) + parser->m_hash_secret_salt = generate_hash_secret_salt(parser); + if (parser->m_ns) { + /* implicit context only set for root parser, since child + parsers (i.e. external entity parsers) will inherit it + */ + return setContext(parser, implicitContext); + } + return XML_TRUE; } XML_Parser XMLCALL XML_ParserCreate_MM(const XML_Char *encodingName, const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep) -{ + const XML_Char *nameSep) { return parserCreate(encodingName, memsuite, nameSep, NULL); } static XML_Parser parserCreate(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep, - DTD *dtd) -{ + const XML_Memory_Handling_Suite *memsuite, const XML_Char *nameSep, + DTD *dtd) { XML_Parser parser; if (memsuite) { XML_Memory_Handling_Suite *mtemp; - parser = (XML_Parser) - memsuite->malloc_fcn(sizeof(struct XML_ParserStruct)); + parser = memsuite->malloc_fcn(sizeof(struct XML_ParserStruct)); if (parser != NULL) { mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); mtemp->malloc_fcn = memsuite->malloc_fcn; mtemp->realloc_fcn = memsuite->realloc_fcn; mtemp->free_fcn = memsuite->free_fcn; } - } - else { + } else { XML_Memory_Handling_Suite *mtemp; parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct)); if (parser != NULL) { @@ -777,287 +991,356 @@ parserCreate(const XML_Char *encodingName, } } - if (!parser) + if (! parser) return parser; - buffer = NULL; - bufferLim = NULL; + parser->m_buffer = NULL; + parser->m_bufferLim = NULL; - attsSize = INIT_ATTS_SIZE; - atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE)); - if (atts == NULL) { - FREE(parser); + parser->m_attsSize = INIT_ATTS_SIZE; + parser->m_atts + = (ATTRIBUTE *)MALLOC(parser, parser->m_attsSize * sizeof(ATTRIBUTE)); + if (parser->m_atts == NULL) { + FREE(parser, parser); return NULL; } #ifdef XML_ATTR_INFO - attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo)); - if (attInfo == NULL) { - FREE(atts); - FREE(parser); + parser->m_attInfo = (XML_AttrInfo *)MALLOC( + parser, parser->m_attsSize * sizeof(XML_AttrInfo)); + if (parser->m_attInfo == NULL) { + FREE(parser, parser->m_atts); + FREE(parser, parser); return NULL; } #endif - dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); - if (dataBuf == NULL) { - FREE(atts); + parser->m_dataBuf + = (XML_Char *)MALLOC(parser, INIT_DATA_BUF_SIZE * sizeof(XML_Char)); + if (parser->m_dataBuf == NULL) { + FREE(parser, parser->m_atts); #ifdef XML_ATTR_INFO - FREE(attInfo); + FREE(parser, parser->m_attInfo); #endif - FREE(parser); + FREE(parser, parser); return NULL; } - dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; + parser->m_dataBufEnd = parser->m_dataBuf + INIT_DATA_BUF_SIZE; if (dtd) - _dtd = dtd; + parser->m_dtd = dtd; else { - _dtd = dtdCreate(&parser->m_mem); - if (_dtd == NULL) { - FREE(dataBuf); - FREE(atts); + parser->m_dtd = dtdCreate(&parser->m_mem); + if (parser->m_dtd == NULL) { + FREE(parser, parser->m_dataBuf); + FREE(parser, parser->m_atts); #ifdef XML_ATTR_INFO - FREE(attInfo); + FREE(parser, parser->m_attInfo); #endif - FREE(parser); + FREE(parser, parser); return NULL; } } - freeBindingList = NULL; - freeTagList = NULL; - freeInternalEntities = NULL; + parser->m_freeBindingList = NULL; + parser->m_freeTagList = NULL; + parser->m_freeInternalEntities = NULL; - groupSize = 0; - groupConnector = NULL; + parser->m_groupSize = 0; + parser->m_groupConnector = NULL; - unknownEncodingHandler = NULL; - unknownEncodingHandlerData = NULL; + parser->m_unknownEncodingHandler = NULL; + parser->m_unknownEncodingHandlerData = NULL; - namespaceSeparator = ASCII_EXCL; - ns = XML_FALSE; - ns_triplets = XML_FALSE; + parser->m_namespaceSeparator = ASCII_EXCL; + parser->m_ns = XML_FALSE; + parser->m_ns_triplets = XML_FALSE; - nsAtts = NULL; - nsAttsVersion = 0; - nsAttsPower = 0; + parser->m_nsAtts = NULL; + parser->m_nsAttsVersion = 0; + parser->m_nsAttsPower = 0; - poolInit(&tempPool, &(parser->m_mem)); - poolInit(&temp2Pool, &(parser->m_mem)); + parser->m_protocolEncodingName = NULL; + + poolInit(&parser->m_tempPool, &(parser->m_mem)); + poolInit(&parser->m_temp2Pool, &(parser->m_mem)); parserInit(parser, encodingName); - if (encodingName && !protocolEncodingName) { + if (encodingName && ! parser->m_protocolEncodingName) { + if (dtd) { + // We need to stop the upcoming call to XML_ParserFree from happily + // destroying parser->m_dtd because the DTD is shared with the parent + // parser and the only guard that keeps XML_ParserFree from destroying + // parser->m_dtd is parser->m_isParamEntity but it will be set to + // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all). + parser->m_dtd = NULL; + } XML_ParserFree(parser); return NULL; } if (nameSep) { - ns = XML_TRUE; - internalEncoding = XmlGetInternalEncodingNS(); - namespaceSeparator = *nameSep; - } - else { - internalEncoding = XmlGetInternalEncoding(); + parser->m_ns = XML_TRUE; + parser->m_internalEncoding = XmlGetInternalEncodingNS(); + parser->m_namespaceSeparator = *nameSep; + } else { + parser->m_internalEncoding = XmlGetInternalEncoding(); } return parser; } static void -parserInit(XML_Parser parser, const XML_Char *encodingName) -{ - processor = prologInitProcessor; - XmlPrologStateInit(&prologState); - protocolEncodingName = (encodingName != NULL - ? poolCopyString(&tempPool, encodingName) - : NULL); - curBase = NULL; - XmlInitEncoding(&initEncoding, &encoding, 0); - userData = NULL; - handlerArg = NULL; - startElementHandler = NULL; - endElementHandler = NULL; - characterDataHandler = NULL; - processingInstructionHandler = NULL; - commentHandler = NULL; - startCdataSectionHandler = NULL; - endCdataSectionHandler = NULL; - defaultHandler = NULL; - startDoctypeDeclHandler = NULL; - endDoctypeDeclHandler = NULL; - unparsedEntityDeclHandler = NULL; - notationDeclHandler = NULL; - startNamespaceDeclHandler = NULL; - endNamespaceDeclHandler = NULL; - notStandaloneHandler = NULL; - externalEntityRefHandler = NULL; - externalEntityRefHandlerArg = parser; - skippedEntityHandler = NULL; - elementDeclHandler = NULL; - attlistDeclHandler = NULL; - entityDeclHandler = NULL; - xmlDeclHandler = NULL; - bufferPtr = buffer; - bufferEnd = buffer; - parseEndByteIndex = 0; - parseEndPtr = NULL; - declElementType = NULL; - declAttributeId = NULL; - declEntity = NULL; - doctypeName = NULL; - doctypeSysid = NULL; - doctypePubid = NULL; - declAttributeType = NULL; - declNotationName = NULL; - declNotationPublicId = NULL; - declAttributeIsCdata = XML_FALSE; - declAttributeIsId = XML_FALSE; - memset(&position, 0, sizeof(POSITION)); - errorCode = XML_ERROR_NONE; - eventPtr = NULL; - eventEndPtr = NULL; - positionPtr = NULL; - openInternalEntities = NULL; - defaultExpandInternalEntities = XML_TRUE; - tagLevel = 0; - tagStack = NULL; - inheritedBindings = NULL; - nSpecifiedAtts = 0; - unknownEncodingMem = NULL; - unknownEncodingRelease = NULL; - unknownEncodingData = NULL; - parentParser = NULL; - ps_parsing = XML_INITIALIZED; +parserInit(XML_Parser parser, const XML_Char *encodingName) { + parser->m_processor = prologInitProcessor; + XmlPrologStateInit(&parser->m_prologState); + if (encodingName != NULL) { + parser->m_protocolEncodingName = copyString(encodingName, &(parser->m_mem)); + } + parser->m_curBase = NULL; + XmlInitEncoding(&parser->m_initEncoding, &parser->m_encoding, 0); + parser->m_userData = NULL; + parser->m_handlerArg = NULL; + parser->m_startElementHandler = NULL; + parser->m_endElementHandler = NULL; + parser->m_characterDataHandler = NULL; + parser->m_processingInstructionHandler = NULL; + parser->m_commentHandler = NULL; + parser->m_startCdataSectionHandler = NULL; + parser->m_endCdataSectionHandler = NULL; + parser->m_defaultHandler = NULL; + parser->m_startDoctypeDeclHandler = NULL; + parser->m_endDoctypeDeclHandler = NULL; + parser->m_unparsedEntityDeclHandler = NULL; + parser->m_notationDeclHandler = NULL; + parser->m_startNamespaceDeclHandler = NULL; + parser->m_endNamespaceDeclHandler = NULL; + parser->m_notStandaloneHandler = NULL; + parser->m_externalEntityRefHandler = NULL; + parser->m_externalEntityRefHandlerArg = parser; + parser->m_skippedEntityHandler = NULL; + parser->m_elementDeclHandler = NULL; + parser->m_attlistDeclHandler = NULL; + parser->m_entityDeclHandler = NULL; + parser->m_xmlDeclHandler = NULL; + parser->m_bufferPtr = parser->m_buffer; + parser->m_bufferEnd = parser->m_buffer; + parser->m_parseEndByteIndex = 0; + parser->m_parseEndPtr = NULL; + parser->m_declElementType = NULL; + parser->m_declAttributeId = NULL; + parser->m_declEntity = NULL; + parser->m_doctypeName = NULL; + parser->m_doctypeSysid = NULL; + parser->m_doctypePubid = NULL; + parser->m_declAttributeType = NULL; + parser->m_declNotationName = NULL; + parser->m_declNotationPublicId = NULL; + parser->m_declAttributeIsCdata = XML_FALSE; + parser->m_declAttributeIsId = XML_FALSE; + memset(&parser->m_position, 0, sizeof(POSITION)); + parser->m_errorCode = XML_ERROR_NONE; + parser->m_eventPtr = NULL; + parser->m_eventEndPtr = NULL; + parser->m_positionPtr = NULL; + parser->m_openInternalEntities = NULL; + parser->m_defaultExpandInternalEntities = XML_TRUE; + parser->m_tagLevel = 0; + parser->m_tagStack = NULL; + parser->m_inheritedBindings = NULL; + parser->m_nSpecifiedAtts = 0; + parser->m_unknownEncodingMem = NULL; + parser->m_unknownEncodingRelease = NULL; + parser->m_unknownEncodingData = NULL; + parser->m_parentParser = NULL; + parser->m_parsingStatus.parsing = XML_INITIALIZED; #ifdef XML_DTD - isParamEntity = XML_FALSE; - useForeignDTD = XML_FALSE; - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; + parser->m_isParamEntity = XML_FALSE; + parser->m_useForeignDTD = XML_FALSE; + parser->m_paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; +#endif + parser->m_hash_secret_salt = 0; + +#ifdef XML_DTD + memset(&parser->m_accounting, 0, sizeof(ACCOUNTING)); + parser->m_accounting.debugLevel = getDebugLevel("EXPAT_ACCOUNTING_DEBUG", 0u); + parser->m_accounting.maximumAmplificationFactor + = EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT; + parser->m_accounting.activationThresholdBytes + = EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT; + + memset(&parser->m_entity_stats, 0, sizeof(ENTITY_STATS)); + parser->m_entity_stats.debugLevel = getDebugLevel("EXPAT_ENTITY_DEBUG", 0u); #endif - hash_secret_salt = 0; } -/* moves list of bindings to freeBindingList */ +/* moves list of bindings to m_freeBindingList */ static void FASTCALL -moveToFreeBindingList(XML_Parser parser, BINDING *bindings) -{ +moveToFreeBindingList(XML_Parser parser, BINDING *bindings) { while (bindings) { BINDING *b = bindings; bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; + b->nextTagBinding = parser->m_freeBindingList; + parser->m_freeBindingList = b; } } XML_Bool XMLCALL -XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) -{ +XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) { TAG *tStk; OPEN_INTERNAL_ENTITY *openEntityList; - if (parentParser) + + if (parser == NULL) return XML_FALSE; - /* move tagStack to freeTagList */ - tStk = tagStack; + + if (parser->m_parentParser) + return XML_FALSE; + /* move m_tagStack to m_freeTagList */ + tStk = parser->m_tagStack; while (tStk) { TAG *tag = tStk; tStk = tStk->parent; - tag->parent = freeTagList; + tag->parent = parser->m_freeTagList; moveToFreeBindingList(parser, tag->bindings); tag->bindings = NULL; - freeTagList = tag; + parser->m_freeTagList = tag; } - /* move openInternalEntities to freeInternalEntities */ - openEntityList = openInternalEntities; + /* move m_openInternalEntities to m_freeInternalEntities */ + openEntityList = parser->m_openInternalEntities; while (openEntityList) { OPEN_INTERNAL_ENTITY *openEntity = openEntityList; openEntityList = openEntity->next; - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; + openEntity->next = parser->m_freeInternalEntities; + parser->m_freeInternalEntities = openEntity; } - moveToFreeBindingList(parser, inheritedBindings); - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - poolClear(&tempPool); - poolClear(&temp2Pool); + moveToFreeBindingList(parser, parser->m_inheritedBindings); + FREE(parser, parser->m_unknownEncodingMem); + if (parser->m_unknownEncodingRelease) + parser->m_unknownEncodingRelease(parser->m_unknownEncodingData); + poolClear(&parser->m_tempPool); + poolClear(&parser->m_temp2Pool); + FREE(parser, (void *)parser->m_protocolEncodingName); + parser->m_protocolEncodingName = NULL; parserInit(parser, encodingName); - dtdReset(_dtd, &parser->m_mem); + dtdReset(parser->m_dtd, &parser->m_mem); return XML_TRUE; } enum XML_Status XMLCALL -XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) -{ +XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) { + if (parser == NULL) + return XML_STATUS_ERROR; /* Block after XML_Parse()/XML_ParseBuffer() has been called. XXX There's no way for the caller to determine which of the XXX possible error cases caused the XML_STATUS_ERROR return. */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) + if (parser->m_parsingStatus.parsing == XML_PARSING + || parser->m_parsingStatus.parsing == XML_SUSPENDED) return XML_STATUS_ERROR; + + /* Get rid of any previous encoding name */ + FREE(parser, (void *)parser->m_protocolEncodingName); + if (encodingName == NULL) - protocolEncodingName = NULL; + /* No new encoding name */ + parser->m_protocolEncodingName = NULL; else { - protocolEncodingName = poolCopyString(&tempPool, encodingName); - if (!protocolEncodingName) + /* Copy the new encoding name into allocated memory */ + parser->m_protocolEncodingName = copyString(encodingName, &(parser->m_mem)); + if (! parser->m_protocolEncodingName) return XML_STATUS_ERROR; } return XML_STATUS_OK; } XML_Parser XMLCALL -XML_ExternalEntityParserCreate(XML_Parser oldParser, - const XML_Char *context, - const XML_Char *encodingName) -{ +XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context, + const XML_Char *encodingName) { XML_Parser parser = oldParser; DTD *newDtd = NULL; - DTD *oldDtd = _dtd; - XML_StartElementHandler oldStartElementHandler = startElementHandler; - XML_EndElementHandler oldEndElementHandler = endElementHandler; - XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; - XML_ProcessingInstructionHandler oldProcessingInstructionHandler - = processingInstructionHandler; - XML_CommentHandler oldCommentHandler = commentHandler; - XML_StartCdataSectionHandler oldStartCdataSectionHandler - = startCdataSectionHandler; - XML_EndCdataSectionHandler oldEndCdataSectionHandler - = endCdataSectionHandler; - XML_DefaultHandler oldDefaultHandler = defaultHandler; - XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler - = unparsedEntityDeclHandler; - XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; - XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler - = startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler - = endNamespaceDeclHandler; - XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; - XML_ExternalEntityRefHandler oldExternalEntityRefHandler - = externalEntityRefHandler; - XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; - XML_UnknownEncodingHandler oldUnknownEncodingHandler - = unknownEncodingHandler; - XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; - XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; - XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; - XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; - ELEMENT_TYPE * oldDeclElementType = declElementType; + DTD *oldDtd; + XML_StartElementHandler oldStartElementHandler; + XML_EndElementHandler oldEndElementHandler; + XML_CharacterDataHandler oldCharacterDataHandler; + XML_ProcessingInstructionHandler oldProcessingInstructionHandler; + XML_CommentHandler oldCommentHandler; + XML_StartCdataSectionHandler oldStartCdataSectionHandler; + XML_EndCdataSectionHandler oldEndCdataSectionHandler; + XML_DefaultHandler oldDefaultHandler; + XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler; + XML_NotationDeclHandler oldNotationDeclHandler; + XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler; + XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler; + XML_NotStandaloneHandler oldNotStandaloneHandler; + XML_ExternalEntityRefHandler oldExternalEntityRefHandler; + XML_SkippedEntityHandler oldSkippedEntityHandler; + XML_UnknownEncodingHandler oldUnknownEncodingHandler; + XML_ElementDeclHandler oldElementDeclHandler; + XML_AttlistDeclHandler oldAttlistDeclHandler; + XML_EntityDeclHandler oldEntityDeclHandler; + XML_XmlDeclHandler oldXmlDeclHandler; + ELEMENT_TYPE *oldDeclElementType; - void *oldUserData = userData; - void *oldHandlerArg = handlerArg; - XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; - XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; + void *oldUserData; + void *oldHandlerArg; + XML_Bool oldDefaultExpandInternalEntities; + XML_Parser oldExternalEntityRefHandlerArg; #ifdef XML_DTD - enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing; - int oldInEntityValue = prologState.inEntityValue; + enum XML_ParamEntityParsing oldParamEntityParsing; + int oldInEntityValue; #endif - XML_Bool oldns_triplets = ns_triplets; + XML_Bool oldns_triplets; /* Note that the new parser shares the same hash secret as the old parser, so that dtdCopy and copyEntityTable can lookup values from hash tables associated with either parser without us having to worry which hash secrets each table has. */ - unsigned long oldhash_secret_salt = hash_secret_salt; + unsigned long oldhash_secret_salt; + + /* Validate the oldParser parameter before we pull everything out of it */ + if (oldParser == NULL) + return NULL; + + /* Stash the original parser contents on the stack */ + oldDtd = parser->m_dtd; + oldStartElementHandler = parser->m_startElementHandler; + oldEndElementHandler = parser->m_endElementHandler; + oldCharacterDataHandler = parser->m_characterDataHandler; + oldProcessingInstructionHandler = parser->m_processingInstructionHandler; + oldCommentHandler = parser->m_commentHandler; + oldStartCdataSectionHandler = parser->m_startCdataSectionHandler; + oldEndCdataSectionHandler = parser->m_endCdataSectionHandler; + oldDefaultHandler = parser->m_defaultHandler; + oldUnparsedEntityDeclHandler = parser->m_unparsedEntityDeclHandler; + oldNotationDeclHandler = parser->m_notationDeclHandler; + oldStartNamespaceDeclHandler = parser->m_startNamespaceDeclHandler; + oldEndNamespaceDeclHandler = parser->m_endNamespaceDeclHandler; + oldNotStandaloneHandler = parser->m_notStandaloneHandler; + oldExternalEntityRefHandler = parser->m_externalEntityRefHandler; + oldSkippedEntityHandler = parser->m_skippedEntityHandler; + oldUnknownEncodingHandler = parser->m_unknownEncodingHandler; + oldElementDeclHandler = parser->m_elementDeclHandler; + oldAttlistDeclHandler = parser->m_attlistDeclHandler; + oldEntityDeclHandler = parser->m_entityDeclHandler; + oldXmlDeclHandler = parser->m_xmlDeclHandler; + oldDeclElementType = parser->m_declElementType; + + oldUserData = parser->m_userData; + oldHandlerArg = parser->m_handlerArg; + oldDefaultExpandInternalEntities = parser->m_defaultExpandInternalEntities; + oldExternalEntityRefHandlerArg = parser->m_externalEntityRefHandlerArg; +#ifdef XML_DTD + oldParamEntityParsing = parser->m_paramEntityParsing; + oldInEntityValue = parser->m_prologState.inEntityValue; +#endif + oldns_triplets = parser->m_ns_triplets; + /* Note that the new parser shares the same hash secret as the old + parser, so that dtdCopy and copyEntityTable can lookup values + from hash tables associated with either parser without us having + to worry which hash secrets each table has. + */ + oldhash_secret_salt = parser->m_hash_secret_salt; #ifdef XML_DTD - if (!context) + if (! context) newDtd = oldDtd; #endif /* XML_DTD */ @@ -1066,445 +1349,457 @@ XML_ExternalEntityParserCreate(XML_Parser oldParser, here. This makes this function more painful to follow than it would be otherwise. */ - if (ns) { - XML_Char tmp[2]; - *tmp = namespaceSeparator; + if (parser->m_ns) { + XML_Char tmp[2] = {parser->m_namespaceSeparator, 0}; parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd); - } - else { + } else { parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd); } - if (!parser) + if (! parser) return NULL; - startElementHandler = oldStartElementHandler; - endElementHandler = oldEndElementHandler; - characterDataHandler = oldCharacterDataHandler; - processingInstructionHandler = oldProcessingInstructionHandler; - commentHandler = oldCommentHandler; - startCdataSectionHandler = oldStartCdataSectionHandler; - endCdataSectionHandler = oldEndCdataSectionHandler; - defaultHandler = oldDefaultHandler; - unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; - notationDeclHandler = oldNotationDeclHandler; - startNamespaceDeclHandler = oldStartNamespaceDeclHandler; - endNamespaceDeclHandler = oldEndNamespaceDeclHandler; - notStandaloneHandler = oldNotStandaloneHandler; - externalEntityRefHandler = oldExternalEntityRefHandler; - skippedEntityHandler = oldSkippedEntityHandler; - unknownEncodingHandler = oldUnknownEncodingHandler; - elementDeclHandler = oldElementDeclHandler; - attlistDeclHandler = oldAttlistDeclHandler; - entityDeclHandler = oldEntityDeclHandler; - xmlDeclHandler = oldXmlDeclHandler; - declElementType = oldDeclElementType; - userData = oldUserData; + parser->m_startElementHandler = oldStartElementHandler; + parser->m_endElementHandler = oldEndElementHandler; + parser->m_characterDataHandler = oldCharacterDataHandler; + parser->m_processingInstructionHandler = oldProcessingInstructionHandler; + parser->m_commentHandler = oldCommentHandler; + parser->m_startCdataSectionHandler = oldStartCdataSectionHandler; + parser->m_endCdataSectionHandler = oldEndCdataSectionHandler; + parser->m_defaultHandler = oldDefaultHandler; + parser->m_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; + parser->m_notationDeclHandler = oldNotationDeclHandler; + parser->m_startNamespaceDeclHandler = oldStartNamespaceDeclHandler; + parser->m_endNamespaceDeclHandler = oldEndNamespaceDeclHandler; + parser->m_notStandaloneHandler = oldNotStandaloneHandler; + parser->m_externalEntityRefHandler = oldExternalEntityRefHandler; + parser->m_skippedEntityHandler = oldSkippedEntityHandler; + parser->m_unknownEncodingHandler = oldUnknownEncodingHandler; + parser->m_elementDeclHandler = oldElementDeclHandler; + parser->m_attlistDeclHandler = oldAttlistDeclHandler; + parser->m_entityDeclHandler = oldEntityDeclHandler; + parser->m_xmlDeclHandler = oldXmlDeclHandler; + parser->m_declElementType = oldDeclElementType; + parser->m_userData = oldUserData; if (oldUserData == oldHandlerArg) - handlerArg = userData; + parser->m_handlerArg = parser->m_userData; else - handlerArg = parser; + parser->m_handlerArg = parser; if (oldExternalEntityRefHandlerArg != oldParser) - externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; - defaultExpandInternalEntities = oldDefaultExpandInternalEntities; - ns_triplets = oldns_triplets; - hash_secret_salt = oldhash_secret_salt; - parentParser = oldParser; + parser->m_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; + parser->m_defaultExpandInternalEntities = oldDefaultExpandInternalEntities; + parser->m_ns_triplets = oldns_triplets; + parser->m_hash_secret_salt = oldhash_secret_salt; + parser->m_parentParser = oldParser; #ifdef XML_DTD - paramEntityParsing = oldParamEntityParsing; - prologState.inEntityValue = oldInEntityValue; + parser->m_paramEntityParsing = oldParamEntityParsing; + parser->m_prologState.inEntityValue = oldInEntityValue; if (context) { #endif /* XML_DTD */ - if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem) - || !setContext(parser, context)) { + if (! dtdCopy(oldParser, parser->m_dtd, oldDtd, &parser->m_mem) + || ! setContext(parser, context)) { XML_ParserFree(parser); return NULL; } - processor = externalEntityInitProcessor; + parser->m_processor = externalEntityInitProcessor; #ifdef XML_DTD - } - else { - /* The DTD instance referenced by _dtd is shared between the document's - root parser and external PE parsers, therefore one does not need to - call setContext. In addition, one also *must* not call setContext, - because this would overwrite existing prefix->binding pointers in - _dtd with ones that get destroyed with the external PE parser. - This would leave those prefixes with dangling pointers. + } else { + /* The DTD instance referenced by parser->m_dtd is shared between the + document's root parser and external PE parsers, therefore one does not + need to call setContext. In addition, one also *must* not call + setContext, because this would overwrite existing prefix->binding + pointers in parser->m_dtd with ones that get destroyed with the external + PE parser. This would leave those prefixes with dangling pointers. */ - isParamEntity = XML_TRUE; - XmlPrologStateInitExternalEntity(&prologState); - processor = externalParEntInitProcessor; + parser->m_isParamEntity = XML_TRUE; + XmlPrologStateInitExternalEntity(&parser->m_prologState); + parser->m_processor = externalParEntInitProcessor; } #endif /* XML_DTD */ return parser; } static void FASTCALL -destroyBindings(BINDING *bindings, XML_Parser parser) -{ +destroyBindings(BINDING *bindings, XML_Parser parser) { for (;;) { BINDING *b = bindings; - if (!b) + if (! b) break; bindings = b->nextTagBinding; - FREE(b->uri); - FREE(b); + FREE(parser, b->uri); + FREE(parser, b); } } void XMLCALL -XML_ParserFree(XML_Parser parser) -{ +XML_ParserFree(XML_Parser parser) { TAG *tagList; OPEN_INTERNAL_ENTITY *entityList; if (parser == NULL) return; - /* free tagStack and freeTagList */ - tagList = tagStack; + /* free m_tagStack and m_freeTagList */ + tagList = parser->m_tagStack; for (;;) { TAG *p; if (tagList == NULL) { - if (freeTagList == NULL) + if (parser->m_freeTagList == NULL) break; - tagList = freeTagList; - freeTagList = NULL; + tagList = parser->m_freeTagList; + parser->m_freeTagList = NULL; } p = tagList; tagList = tagList->parent; - FREE(p->buf); + FREE(parser, p->buf); destroyBindings(p->bindings, parser); - FREE(p); + FREE(parser, p); } - /* free openInternalEntities and freeInternalEntities */ - entityList = openInternalEntities; + /* free m_openInternalEntities and m_freeInternalEntities */ + entityList = parser->m_openInternalEntities; for (;;) { OPEN_INTERNAL_ENTITY *openEntity; if (entityList == NULL) { - if (freeInternalEntities == NULL) + if (parser->m_freeInternalEntities == NULL) break; - entityList = freeInternalEntities; - freeInternalEntities = NULL; + entityList = parser->m_freeInternalEntities; + parser->m_freeInternalEntities = NULL; } openEntity = entityList; entityList = entityList->next; - FREE(openEntity); + FREE(parser, openEntity); } - destroyBindings(freeBindingList, parser); - destroyBindings(inheritedBindings, parser); - poolDestroy(&tempPool); - poolDestroy(&temp2Pool); + destroyBindings(parser->m_freeBindingList, parser); + destroyBindings(parser->m_inheritedBindings, parser); + poolDestroy(&parser->m_tempPool); + poolDestroy(&parser->m_temp2Pool); + FREE(parser, (void *)parser->m_protocolEncodingName); #ifdef XML_DTD /* external parameter entity parsers share the DTD structure parser->m_dtd with the root parser, so we must not destroy it */ - if (!isParamEntity && _dtd) + if (! parser->m_isParamEntity && parser->m_dtd) #else - if (_dtd) + if (parser->m_dtd) #endif /* XML_DTD */ - dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem); - FREE((void *)atts); + dtdDestroy(parser->m_dtd, (XML_Bool)! parser->m_parentParser, + &parser->m_mem); + FREE(parser, (void *)parser->m_atts); #ifdef XML_ATTR_INFO - FREE((void *)attInfo); + FREE(parser, (void *)parser->m_attInfo); #endif - FREE(groupConnector); - FREE(buffer); - FREE(dataBuf); - FREE(nsAtts); - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - FREE(parser); + FREE(parser, parser->m_groupConnector); + FREE(parser, parser->m_buffer); + FREE(parser, parser->m_dataBuf); + FREE(parser, parser->m_nsAtts); + FREE(parser, parser->m_unknownEncodingMem); + if (parser->m_unknownEncodingRelease) + parser->m_unknownEncodingRelease(parser->m_unknownEncodingData); + FREE(parser, parser); } void XMLCALL -XML_UseParserAsHandlerArg(XML_Parser parser) -{ - handlerArg = parser; +XML_UseParserAsHandlerArg(XML_Parser parser) { + if (parser != NULL) + parser->m_handlerArg = parser; } enum XML_Error XMLCALL -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) -{ +XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) { + if (parser == NULL) + return XML_ERROR_INVALID_ARGUMENT; #ifdef XML_DTD /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) + if (parser->m_parsingStatus.parsing == XML_PARSING + || parser->m_parsingStatus.parsing == XML_SUSPENDED) return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING; - useForeignDTD = useDTD; + parser->m_useForeignDTD = useDTD; return XML_ERROR_NONE; #else + UNUSED_P(useDTD); return XML_ERROR_FEATURE_REQUIRES_XML_DTD; #endif } void XMLCALL -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) +XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) { + if (parser == NULL) return; - ns_triplets = do_nst ? XML_TRUE : XML_FALSE; + /* block after XML_Parse()/XML_ParseBuffer() has been called */ + if (parser->m_parsingStatus.parsing == XML_PARSING + || parser->m_parsingStatus.parsing == XML_SUSPENDED) + return; + parser->m_ns_triplets = do_nst ? XML_TRUE : XML_FALSE; } void XMLCALL -XML_SetUserData(XML_Parser parser, void *p) -{ - if (handlerArg == userData) - handlerArg = userData = p; +XML_SetUserData(XML_Parser parser, void *p) { + if (parser == NULL) + return; + if (parser->m_handlerArg == parser->m_userData) + parser->m_handlerArg = parser->m_userData = p; else - userData = p; + parser->m_userData = p; } enum XML_Status XMLCALL -XML_SetBase(XML_Parser parser, const XML_Char *p) -{ +XML_SetBase(XML_Parser parser, const XML_Char *p) { + if (parser == NULL) + return XML_STATUS_ERROR; if (p) { - p = poolCopyString(&_dtd->pool, p); - if (!p) + p = poolCopyString(&parser->m_dtd->pool, p); + if (! p) return XML_STATUS_ERROR; - curBase = p; - } - else - curBase = NULL; + parser->m_curBase = p; + } else + parser->m_curBase = NULL; return XML_STATUS_OK; } -const XML_Char * XMLCALL -XML_GetBase(XML_Parser parser) -{ - return curBase; +const XML_Char *XMLCALL +XML_GetBase(XML_Parser parser) { + if (parser == NULL) + return NULL; + return parser->m_curBase; } int XMLCALL -XML_GetSpecifiedAttributeCount(XML_Parser parser) -{ - return nSpecifiedAtts; +XML_GetSpecifiedAttributeCount(XML_Parser parser) { + if (parser == NULL) + return -1; + return parser->m_nSpecifiedAtts; } int XMLCALL -XML_GetIdAttributeIndex(XML_Parser parser) -{ - return idAttIndex; +XML_GetIdAttributeIndex(XML_Parser parser) { + if (parser == NULL) + return -1; + return parser->m_idAttIndex; } #ifdef XML_ATTR_INFO -const XML_AttrInfo * XMLCALL -XML_GetAttributeInfo(XML_Parser parser) -{ - return attInfo; +const XML_AttrInfo *XMLCALL +XML_GetAttributeInfo(XML_Parser parser) { + if (parser == NULL) + return NULL; + return parser->m_attInfo; } #endif void XMLCALL -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end) -{ - startElementHandler = start; - endElementHandler = end; +XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, + XML_EndElementHandler end) { + if (parser == NULL) + return; + parser->m_startElementHandler = start; + parser->m_endElementHandler = end; } void XMLCALL -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler start) { - startElementHandler = start; +XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start) { + if (parser != NULL) + parser->m_startElementHandler = start; } void XMLCALL -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler end) { - endElementHandler = end; +XML_SetEndElementHandler(XML_Parser parser, XML_EndElementHandler end) { + if (parser != NULL) + parser->m_endElementHandler = end; } void XMLCALL XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler) -{ - characterDataHandler = handler; + XML_CharacterDataHandler handler) { + if (parser != NULL) + parser->m_characterDataHandler = handler; } void XMLCALL XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler) -{ - processingInstructionHandler = handler; + XML_ProcessingInstructionHandler handler) { + if (parser != NULL) + parser->m_processingInstructionHandler = handler; } void XMLCALL -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler) -{ - commentHandler = handler; +XML_SetCommentHandler(XML_Parser parser, XML_CommentHandler handler) { + if (parser != NULL) + parser->m_commentHandler = handler; } void XMLCALL XML_SetCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end) -{ - startCdataSectionHandler = start; - endCdataSectionHandler = end; + XML_EndCdataSectionHandler end) { + if (parser == NULL) + return; + parser->m_startCdataSectionHandler = start; + parser->m_endCdataSectionHandler = end; } void XMLCALL XML_SetStartCdataSectionHandler(XML_Parser parser, XML_StartCdataSectionHandler start) { - startCdataSectionHandler = start; + if (parser != NULL) + parser->m_startCdataSectionHandler = start; } void XMLCALL XML_SetEndCdataSectionHandler(XML_Parser parser, XML_EndCdataSectionHandler end) { - endCdataSectionHandler = end; + if (parser != NULL) + parser->m_endCdataSectionHandler = end; } void XMLCALL -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_FALSE; +XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler) { + if (parser == NULL) + return; + parser->m_defaultHandler = handler; + parser->m_defaultExpandInternalEntities = XML_FALSE; } void XMLCALL -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_TRUE; +XML_SetDefaultHandlerExpand(XML_Parser parser, XML_DefaultHandler handler) { + if (parser == NULL) + return; + parser->m_defaultHandler = handler; + parser->m_defaultExpandInternalEntities = XML_TRUE; } void XMLCALL -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end) -{ - startDoctypeDeclHandler = start; - endDoctypeDeclHandler = end; +XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, + XML_EndDoctypeDeclHandler end) { + if (parser == NULL) + return; + parser->m_startDoctypeDeclHandler = start; + parser->m_endDoctypeDeclHandler = end; } void XMLCALL XML_SetStartDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start) { - startDoctypeDeclHandler = start; + if (parser != NULL) + parser->m_startDoctypeDeclHandler = start; } void XMLCALL -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end) { - endDoctypeDeclHandler = end; +XML_SetEndDoctypeDeclHandler(XML_Parser parser, XML_EndDoctypeDeclHandler end) { + if (parser != NULL) + parser->m_endDoctypeDeclHandler = end; } void XMLCALL XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler) -{ - unparsedEntityDeclHandler = handler; + XML_UnparsedEntityDeclHandler handler) { + if (parser != NULL) + parser->m_unparsedEntityDeclHandler = handler; } void XMLCALL -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler) -{ - notationDeclHandler = handler; +XML_SetNotationDeclHandler(XML_Parser parser, XML_NotationDeclHandler handler) { + if (parser != NULL) + parser->m_notationDeclHandler = handler; } void XMLCALL XML_SetNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end) -{ - startNamespaceDeclHandler = start; - endNamespaceDeclHandler = end; + XML_EndNamespaceDeclHandler end) { + if (parser == NULL) + return; + parser->m_startNamespaceDeclHandler = start; + parser->m_endNamespaceDeclHandler = end; } void XMLCALL XML_SetStartNamespaceDeclHandler(XML_Parser parser, XML_StartNamespaceDeclHandler start) { - startNamespaceDeclHandler = start; + if (parser != NULL) + parser->m_startNamespaceDeclHandler = start; } void XMLCALL XML_SetEndNamespaceDeclHandler(XML_Parser parser, XML_EndNamespaceDeclHandler end) { - endNamespaceDeclHandler = end; + if (parser != NULL) + parser->m_endNamespaceDeclHandler = end; } void XMLCALL XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler) -{ - notStandaloneHandler = handler; + XML_NotStandaloneHandler handler) { + if (parser != NULL) + parser->m_notStandaloneHandler = handler; } void XMLCALL XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler) -{ - externalEntityRefHandler = handler; + XML_ExternalEntityRefHandler handler) { + if (parser != NULL) + parser->m_externalEntityRefHandler = handler; } void XMLCALL -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) -{ +XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) { + if (parser == NULL) + return; if (arg) - externalEntityRefHandlerArg = (XML_Parser)arg; + parser->m_externalEntityRefHandlerArg = (XML_Parser)arg; else - externalEntityRefHandlerArg = parser; + parser->m_externalEntityRefHandlerArg = parser; } void XMLCALL XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler) -{ - skippedEntityHandler = handler; + XML_SkippedEntityHandler handler) { + if (parser != NULL) + parser->m_skippedEntityHandler = handler; } void XMLCALL XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *data) -{ - unknownEncodingHandler = handler; - unknownEncodingHandlerData = data; + XML_UnknownEncodingHandler handler, void *data) { + if (parser == NULL) + return; + parser->m_unknownEncodingHandler = handler; + parser->m_unknownEncodingHandlerData = data; } void XMLCALL -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl) -{ - elementDeclHandler = eldecl; +XML_SetElementDeclHandler(XML_Parser parser, XML_ElementDeclHandler eldecl) { + if (parser != NULL) + parser->m_elementDeclHandler = eldecl; } void XMLCALL -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl) -{ - attlistDeclHandler = attdecl; +XML_SetAttlistDeclHandler(XML_Parser parser, XML_AttlistDeclHandler attdecl) { + if (parser != NULL) + parser->m_attlistDeclHandler = attdecl; } void XMLCALL -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler) -{ - entityDeclHandler = handler; +XML_SetEntityDeclHandler(XML_Parser parser, XML_EntityDeclHandler handler) { + if (parser != NULL) + parser->m_entityDeclHandler = handler; } void XMLCALL -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler handler) { - xmlDeclHandler = handler; +XML_SetXmlDeclHandler(XML_Parser parser, XML_XmlDeclHandler handler) { + if (parser != NULL) + parser->m_xmlDeclHandler = handler; } int XMLCALL XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing peParsing) -{ + enum XML_ParamEntityParsing peParsing) { + if (parser == NULL) + return 0; /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) + if (parser->m_parsingStatus.parsing == XML_PARSING + || parser->m_parsingStatus.parsing == XML_SUSPENDED) return 0; #ifdef XML_DTD - paramEntityParsing = peParsing; + parser->m_paramEntityParsing = peParsing; return 1; #else return peParsing == XML_PARAM_ENTITY_PARSING_NEVER; @@ -1512,91 +1807,122 @@ XML_SetParamEntityParsing(XML_Parser parser, } int XMLCALL -XML_SetHashSalt(XML_Parser parser, - unsigned long hash_salt) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) +XML_SetHashSalt(XML_Parser parser, unsigned long hash_salt) { + if (parser == NULL) return 0; - hash_secret_salt = hash_salt; + if (parser->m_parentParser) + return XML_SetHashSalt(parser->m_parentParser, hash_salt); + /* block after XML_Parse()/XML_ParseBuffer() has been called */ + if (parser->m_parsingStatus.parsing == XML_PARSING + || parser->m_parsingStatus.parsing == XML_SUSPENDED) + return 0; + parser->m_hash_secret_salt = hash_salt; return 1; } enum XML_Status XMLCALL -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) -{ - switch (ps_parsing) { +XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) { + if ((parser == NULL) || (len < 0) || ((s == NULL) && (len != 0))) { + if (parser != NULL) + parser->m_errorCode = XML_ERROR_INVALID_ARGUMENT; + return XML_STATUS_ERROR; + } + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; + parser->m_errorCode = XML_ERROR_SUSPENDED; return XML_STATUS_ERROR; case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; + parser->m_errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; case XML_INITIALIZED: - if (parentParser == NULL && !startParsing(parser)) { - errorCode = XML_ERROR_NO_MEMORY; + if (parser->m_parentParser == NULL && ! startParsing(parser)) { + parser->m_errorCode = XML_ERROR_NO_MEMORY; return XML_STATUS_ERROR; } + /* fall through */ default: - ps_parsing = XML_PARSING; + parser->m_parsingStatus.parsing = XML_PARSING; } if (len == 0) { - ps_finalBuffer = (XML_Bool)isFinal; - if (!isFinal) + parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal; + if (! isFinal) return XML_STATUS_OK; - positionPtr = bufferPtr; - parseEndPtr = bufferEnd; + parser->m_positionPtr = parser->m_bufferPtr; + parser->m_parseEndPtr = parser->m_bufferEnd; /* If data are left over from last buffer, and we now know that these data are the final chunk of input, then we have to check them again to detect errors based on that fact. */ - errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); + parser->m_errorCode + = parser->m_processor(parser, parser->m_bufferPtr, + parser->m_parseEndPtr, &parser->m_bufferPtr); - if (errorCode == XML_ERROR_NONE) { - switch (ps_parsing) { + if (parser->m_errorCode == XML_ERROR_NONE) { + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; + /* It is hard to be certain, but it seems that this case + * cannot occur. This code is cleaning up a previous parse + * with no new data (since len == 0). Changing the parsing + * state requires getting to execute a handler function, and + * there doesn't seem to be an opportunity for that while in + * this circumstance. + * + * Given the uncertainty, we retain the code but exclude it + * from coverage tests. + * + * LCOV_EXCL_START + */ + XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, + parser->m_bufferPtr, &parser->m_position); + parser->m_positionPtr = parser->m_bufferPtr; return XML_STATUS_SUSPENDED; + /* LCOV_EXCL_STOP */ case XML_INITIALIZED: case XML_PARSING: - ps_parsing = XML_FINISHED; + parser->m_parsingStatus.parsing = XML_FINISHED; /* fall through */ default: return XML_STATUS_OK; } } - eventEndPtr = eventPtr; - processor = errorProcessor; + parser->m_eventEndPtr = parser->m_eventPtr; + parser->m_processor = errorProcessor; return XML_STATUS_ERROR; } #ifndef XML_CONTEXT_BYTES - else if (bufferPtr == bufferEnd) { + else if (parser->m_bufferPtr == parser->m_bufferEnd) { const char *end; int nLeftOver; enum XML_Status result; - parseEndByteIndex += len; - positionPtr = s; - ps_finalBuffer = (XML_Bool)isFinal; - - errorCode = processor(parser, s, parseEndPtr = s + len, &end); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; + /* Detect overflow (a+b > MAX <==> b > MAX-a) */ + if ((XML_Size)len > ((XML_Size)-1) / 2 - parser->m_parseEndByteIndex) { + parser->m_errorCode = XML_ERROR_NO_MEMORY; + parser->m_eventPtr = parser->m_eventEndPtr = NULL; + parser->m_processor = errorProcessor; return XML_STATUS_ERROR; } - else { - switch (ps_parsing) { + parser->m_parseEndByteIndex += len; + parser->m_positionPtr = s; + parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal; + + parser->m_errorCode + = parser->m_processor(parser, s, parser->m_parseEndPtr = s + len, &end); + + if (parser->m_errorCode != XML_ERROR_NONE) { + parser->m_eventEndPtr = parser->m_eventPtr; + parser->m_processor = errorProcessor; + return XML_STATUS_ERROR; + } else { + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break; case XML_INITIALIZED: case XML_PARSING: if (isFinal) { - ps_parsing = XML_FINISHED; + parser->m_parsingStatus.parsing = XML_FINISHED; return XML_STATUS_OK; } /* fall through */ @@ -1605,35 +1931,38 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) } } - XmlUpdatePosition(encoding, positionPtr, end, &position); + XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, end, + &parser->m_position); nLeftOver = s + len - end; if (nLeftOver) { - if (buffer == NULL || nLeftOver > bufferLim - buffer) { - /* FIXME avoid integer overflow */ - char *temp; - temp = (buffer == NULL - ? (char *)MALLOC(len * 2) - : (char *)REALLOC(buffer, len * 2)); + if (parser->m_buffer == NULL + || nLeftOver > parser->m_bufferLim - parser->m_buffer) { + /* avoid _signed_ integer overflow */ + char *temp = NULL; + const int bytesToAllocate = (int)((unsigned)len * 2U); + if (bytesToAllocate > 0) { + temp = (char *)REALLOC(parser, parser->m_buffer, bytesToAllocate); + } if (temp == NULL) { - errorCode = XML_ERROR_NO_MEMORY; - eventPtr = eventEndPtr = NULL; - processor = errorProcessor; + parser->m_errorCode = XML_ERROR_NO_MEMORY; + parser->m_eventPtr = parser->m_eventEndPtr = NULL; + parser->m_processor = errorProcessor; return XML_STATUS_ERROR; } - buffer = temp; - bufferLim = buffer + len * 2; + parser->m_buffer = temp; + parser->m_bufferLim = parser->m_buffer + bytesToAllocate; } - memcpy(buffer, end, nLeftOver); + memcpy(parser->m_buffer, end, nLeftOver); } - bufferPtr = buffer; - bufferEnd = buffer + nLeftOver; - positionPtr = bufferPtr; - parseEndPtr = bufferEnd; - eventPtr = bufferPtr; - eventEndPtr = bufferPtr; + parser->m_bufferPtr = parser->m_buffer; + parser->m_bufferEnd = parser->m_buffer + nLeftOver; + parser->m_positionPtr = parser->m_bufferPtr; + parser->m_parseEndPtr = parser->m_bufferEnd; + parser->m_eventPtr = parser->m_bufferPtr; + parser->m_eventEndPtr = parser->m_bufferPtr; return result; } -#endif /* not defined XML_CONTEXT_BYTES */ +#endif /* not defined XML_CONTEXT_BYTES */ else { void *buff = XML_GetBuffer(parser, len); if (buff == NULL) @@ -1646,379 +1975,489 @@ XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) } enum XML_Status XMLCALL -XML_ParseBuffer(XML_Parser parser, int len, int isFinal) -{ +XML_ParseBuffer(XML_Parser parser, int len, int isFinal) { const char *start; enum XML_Status result = XML_STATUS_OK; - switch (ps_parsing) { + if (parser == NULL) + return XML_STATUS_ERROR; + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; + parser->m_errorCode = XML_ERROR_SUSPENDED; return XML_STATUS_ERROR; case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; + parser->m_errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; case XML_INITIALIZED: - if (parentParser == NULL && !startParsing(parser)) { - errorCode = XML_ERROR_NO_MEMORY; + /* Has someone called XML_GetBuffer successfully before? */ + if (! parser->m_bufferPtr) { + parser->m_errorCode = XML_ERROR_NO_BUFFER; return XML_STATUS_ERROR; } + + if (parser->m_parentParser == NULL && ! startParsing(parser)) { + parser->m_errorCode = XML_ERROR_NO_MEMORY; + return XML_STATUS_ERROR; + } + /* fall through */ default: - ps_parsing = XML_PARSING; + parser->m_parsingStatus.parsing = XML_PARSING; } - start = bufferPtr; - positionPtr = start; - bufferEnd += len; - parseEndPtr = bufferEnd; - parseEndByteIndex += len; - ps_finalBuffer = (XML_Bool)isFinal; + start = parser->m_bufferPtr; + parser->m_positionPtr = start; + parser->m_bufferEnd += len; + parser->m_parseEndPtr = parser->m_bufferEnd; + parser->m_parseEndByteIndex += len; + parser->m_parsingStatus.finalBuffer = (XML_Bool)isFinal; - errorCode = processor(parser, start, parseEndPtr, &bufferPtr); + parser->m_errorCode = parser->m_processor( + parser, start, parser->m_parseEndPtr, &parser->m_bufferPtr); - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; + if (parser->m_errorCode != XML_ERROR_NONE) { + parser->m_eventEndPtr = parser->m_eventPtr; + parser->m_processor = errorProcessor; return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { + } else { + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break; case XML_INITIALIZED: case XML_PARSING: if (isFinal) { - ps_parsing = XML_FINISHED; + parser->m_parsingStatus.parsing = XML_FINISHED; return result; } - default: ; /* should not happen */ + default:; /* should not happen */ } } - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; + XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, + parser->m_bufferPtr, &parser->m_position); + parser->m_positionPtr = parser->m_bufferPtr; return result; } -void * XMLCALL -XML_GetBuffer(XML_Parser parser, int len) -{ +void *XMLCALL +XML_GetBuffer(XML_Parser parser, int len) { + if (parser == NULL) + return NULL; if (len < 0) { - errorCode = XML_ERROR_NO_MEMORY; + parser->m_errorCode = XML_ERROR_NO_MEMORY; return NULL; } - switch (ps_parsing) { + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; + parser->m_errorCode = XML_ERROR_SUSPENDED; return NULL; case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; + parser->m_errorCode = XML_ERROR_FINISHED; return NULL; - default: ; + default:; } - if (len > bufferLim - bufferEnd) { + if (len > EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_bufferEnd)) { #ifdef XML_CONTEXT_BYTES int keep; -#endif /* defined XML_CONTEXT_BYTES */ +#endif /* defined XML_CONTEXT_BYTES */ /* Do not invoke signed arithmetic overflow: */ - int neededSize = (int) ((unsigned)len + (unsigned)(bufferEnd - bufferPtr)); + int neededSize = (int)((unsigned)len + + (unsigned)EXPAT_SAFE_PTR_DIFF( + parser->m_bufferEnd, parser->m_bufferPtr)); if (neededSize < 0) { - errorCode = XML_ERROR_NO_MEMORY; + parser->m_errorCode = XML_ERROR_NO_MEMORY; return NULL; } #ifdef XML_CONTEXT_BYTES - keep = (int)(bufferPtr - buffer); + keep = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer); if (keep > XML_CONTEXT_BYTES) keep = XML_CONTEXT_BYTES; + /* Detect and prevent integer overflow */ + if (keep > INT_MAX - neededSize) { + parser->m_errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } neededSize += keep; -#endif /* defined XML_CONTEXT_BYTES */ - if (neededSize <= bufferLim - buffer) { +#endif /* defined XML_CONTEXT_BYTES */ + if (neededSize + <= EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_buffer)) { #ifdef XML_CONTEXT_BYTES - if (keep < bufferPtr - buffer) { - int offset = (int)(bufferPtr - buffer) - keep; - memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep); - bufferEnd -= offset; - bufferPtr -= offset; + if (keep < EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer)) { + int offset + = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferPtr, parser->m_buffer) + - keep; + /* The buffer pointers cannot be NULL here; we have at least some bytes + * in the buffer */ + memmove(parser->m_buffer, &parser->m_buffer[offset], + parser->m_bufferEnd - parser->m_bufferPtr + keep); + parser->m_bufferEnd -= offset; + parser->m_bufferPtr -= offset; } #else - memmove(buffer, bufferPtr, bufferEnd - bufferPtr); - bufferEnd = buffer + (bufferEnd - bufferPtr); - bufferPtr = buffer; -#endif /* not defined XML_CONTEXT_BYTES */ - } - else { + if (parser->m_buffer && parser->m_bufferPtr) { + memmove(parser->m_buffer, parser->m_bufferPtr, + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr)); + parser->m_bufferEnd + = parser->m_buffer + + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr); + parser->m_bufferPtr = parser->m_buffer; + } +#endif /* not defined XML_CONTEXT_BYTES */ + } else { char *newBuf; - int bufferSize = (int)(bufferLim - bufferPtr); + int bufferSize + = (int)EXPAT_SAFE_PTR_DIFF(parser->m_bufferLim, parser->m_bufferPtr); if (bufferSize == 0) bufferSize = INIT_BUFFER_SIZE; do { /* Do not invoke signed arithmetic overflow: */ - bufferSize = (int) (2U * (unsigned) bufferSize); + bufferSize = (int)(2U * (unsigned)bufferSize); } while (bufferSize < neededSize && bufferSize > 0); if (bufferSize <= 0) { - errorCode = XML_ERROR_NO_MEMORY; + parser->m_errorCode = XML_ERROR_NO_MEMORY; return NULL; } - newBuf = (char *)MALLOC(bufferSize); + newBuf = (char *)MALLOC(parser, bufferSize); if (newBuf == 0) { - errorCode = XML_ERROR_NO_MEMORY; + parser->m_errorCode = XML_ERROR_NO_MEMORY; return NULL; } - bufferLim = newBuf + bufferSize; + parser->m_bufferLim = newBuf + bufferSize; #ifdef XML_CONTEXT_BYTES - if (bufferPtr) { - int keep = (int)(bufferPtr - buffer); - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep); - FREE(buffer); - buffer = newBuf; - bufferEnd = buffer + (bufferEnd - bufferPtr) + keep; - bufferPtr = buffer + keep; - } - else { - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; + if (parser->m_bufferPtr) { + memcpy(newBuf, &parser->m_bufferPtr[-keep], + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr) + + keep); + FREE(parser, parser->m_buffer); + parser->m_buffer = newBuf; + parser->m_bufferEnd + = parser->m_buffer + + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr) + + keep; + parser->m_bufferPtr = parser->m_buffer + keep; + } else { + /* This must be a brand new buffer with no data in it yet */ + parser->m_bufferEnd = newBuf; + parser->m_bufferPtr = parser->m_buffer = newBuf; } #else - if (bufferPtr) { - memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); - FREE(buffer); + if (parser->m_bufferPtr) { + memcpy(newBuf, parser->m_bufferPtr, + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr)); + FREE(parser, parser->m_buffer); + parser->m_bufferEnd + = newBuf + + EXPAT_SAFE_PTR_DIFF(parser->m_bufferEnd, parser->m_bufferPtr); + } else { + /* This must be a brand new buffer with no data in it yet */ + parser->m_bufferEnd = newBuf; } - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; -#endif /* not defined XML_CONTEXT_BYTES */ + parser->m_bufferPtr = parser->m_buffer = newBuf; +#endif /* not defined XML_CONTEXT_BYTES */ } - eventPtr = eventEndPtr = NULL; - positionPtr = NULL; + parser->m_eventPtr = parser->m_eventEndPtr = NULL; + parser->m_positionPtr = NULL; } - return bufferEnd; + return parser->m_bufferEnd; } enum XML_Status XMLCALL -XML_StopParser(XML_Parser parser, XML_Bool resumable) -{ - switch (ps_parsing) { +XML_StopParser(XML_Parser parser, XML_Bool resumable) { + if (parser == NULL) + return XML_STATUS_ERROR; + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: if (resumable) { - errorCode = XML_ERROR_SUSPENDED; + parser->m_errorCode = XML_ERROR_SUSPENDED; return XML_STATUS_ERROR; } - ps_parsing = XML_FINISHED; + parser->m_parsingStatus.parsing = XML_FINISHED; break; case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; + parser->m_errorCode = XML_ERROR_FINISHED; return XML_STATUS_ERROR; default: if (resumable) { #ifdef XML_DTD - if (isParamEntity) { - errorCode = XML_ERROR_SUSPEND_PE; + if (parser->m_isParamEntity) { + parser->m_errorCode = XML_ERROR_SUSPEND_PE; return XML_STATUS_ERROR; } #endif - ps_parsing = XML_SUSPENDED; - } - else - ps_parsing = XML_FINISHED; + parser->m_parsingStatus.parsing = XML_SUSPENDED; + } else + parser->m_parsingStatus.parsing = XML_FINISHED; } return XML_STATUS_OK; } enum XML_Status XMLCALL -XML_ResumeParser(XML_Parser parser) -{ +XML_ResumeParser(XML_Parser parser) { enum XML_Status result = XML_STATUS_OK; - if (ps_parsing != XML_SUSPENDED) { - errorCode = XML_ERROR_NOT_SUSPENDED; + if (parser == NULL) + return XML_STATUS_ERROR; + if (parser->m_parsingStatus.parsing != XML_SUSPENDED) { + parser->m_errorCode = XML_ERROR_NOT_SUSPENDED; return XML_STATUS_ERROR; } - ps_parsing = XML_PARSING; + parser->m_parsingStatus.parsing = XML_PARSING; - errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); + parser->m_errorCode = parser->m_processor( + parser, parser->m_bufferPtr, parser->m_parseEndPtr, &parser->m_bufferPtr); - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; + if (parser->m_errorCode != XML_ERROR_NONE) { + parser->m_eventEndPtr = parser->m_eventPtr; + parser->m_processor = errorProcessor; return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { + } else { + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: result = XML_STATUS_SUSPENDED; break; case XML_INITIALIZED: case XML_PARSING: - if (ps_finalBuffer) { - ps_parsing = XML_FINISHED; + if (parser->m_parsingStatus.finalBuffer) { + parser->m_parsingStatus.parsing = XML_FINISHED; return result; } - default: ; + default:; } } - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; + XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, + parser->m_bufferPtr, &parser->m_position); + parser->m_positionPtr = parser->m_bufferPtr; return result; } void XMLCALL -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) -{ +XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) { + if (parser == NULL) + return; assert(status != NULL); *status = parser->m_parsingStatus; } enum XML_Error XMLCALL -XML_GetErrorCode(XML_Parser parser) -{ - return errorCode; +XML_GetErrorCode(XML_Parser parser) { + if (parser == NULL) + return XML_ERROR_INVALID_ARGUMENT; + return parser->m_errorCode; } XML_Index XMLCALL -XML_GetCurrentByteIndex(XML_Parser parser) -{ - if (eventPtr) - return (XML_Index)(parseEndByteIndex - (parseEndPtr - eventPtr)); +XML_GetCurrentByteIndex(XML_Parser parser) { + if (parser == NULL) + return -1; + if (parser->m_eventPtr) + return (XML_Index)(parser->m_parseEndByteIndex + - (parser->m_parseEndPtr - parser->m_eventPtr)); return -1; } int XMLCALL -XML_GetCurrentByteCount(XML_Parser parser) -{ - if (eventEndPtr && eventPtr) - return (int)(eventEndPtr - eventPtr); +XML_GetCurrentByteCount(XML_Parser parser) { + if (parser == NULL) + return 0; + if (parser->m_eventEndPtr && parser->m_eventPtr) + return (int)(parser->m_eventEndPtr - parser->m_eventPtr); return 0; } -const char * XMLCALL -XML_GetInputContext(XML_Parser parser, int *offset, int *size) -{ +const char *XMLCALL +XML_GetInputContext(XML_Parser parser, int *offset, int *size) { #ifdef XML_CONTEXT_BYTES - if (eventPtr && buffer) { - *offset = (int)(eventPtr - buffer); - *size = (int)(bufferEnd - buffer); - return buffer; + if (parser == NULL) + return NULL; + if (parser->m_eventPtr && parser->m_buffer) { + if (offset != NULL) + *offset = (int)(parser->m_eventPtr - parser->m_buffer); + if (size != NULL) + *size = (int)(parser->m_bufferEnd - parser->m_buffer); + return parser->m_buffer; } +#else + (void)parser; + (void)offset; + (void)size; #endif /* defined XML_CONTEXT_BYTES */ - return (char *) 0; + return (const char *)0; } XML_Size XMLCALL -XML_GetCurrentLineNumber(XML_Parser parser) -{ - if (eventPtr && eventPtr >= positionPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; +XML_GetCurrentLineNumber(XML_Parser parser) { + if (parser == NULL) + return 0; + if (parser->m_eventPtr && parser->m_eventPtr >= parser->m_positionPtr) { + XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, + parser->m_eventPtr, &parser->m_position); + parser->m_positionPtr = parser->m_eventPtr; } - return position.lineNumber + 1; + return parser->m_position.lineNumber + 1; } XML_Size XMLCALL -XML_GetCurrentColumnNumber(XML_Parser parser) -{ - if (eventPtr && eventPtr >= positionPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; +XML_GetCurrentColumnNumber(XML_Parser parser) { + if (parser == NULL) + return 0; + if (parser->m_eventPtr && parser->m_eventPtr >= parser->m_positionPtr) { + XmlUpdatePosition(parser->m_encoding, parser->m_positionPtr, + parser->m_eventPtr, &parser->m_position); + parser->m_positionPtr = parser->m_eventPtr; } - return position.columnNumber; + return parser->m_position.columnNumber; } void XMLCALL -XML_FreeContentModel(XML_Parser parser, XML_Content *model) -{ - FREE(model); +XML_FreeContentModel(XML_Parser parser, XML_Content *model) { + if (parser != NULL) + FREE(parser, model); } -void * XMLCALL -XML_MemMalloc(XML_Parser parser, size_t size) -{ - return MALLOC(size); +void *XMLCALL +XML_MemMalloc(XML_Parser parser, size_t size) { + if (parser == NULL) + return NULL; + return MALLOC(parser, size); } -void * XMLCALL -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) -{ - return REALLOC(ptr, size); +void *XMLCALL +XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) { + if (parser == NULL) + return NULL; + return REALLOC(parser, ptr, size); } void XMLCALL -XML_MemFree(XML_Parser parser, void *ptr) -{ - FREE(ptr); +XML_MemFree(XML_Parser parser, void *ptr) { + if (parser != NULL) + FREE(parser, ptr); } void XMLCALL -XML_DefaultCurrent(XML_Parser parser) -{ - if (defaultHandler) { - if (openInternalEntities) - reportDefault(parser, - internalEncoding, - openInternalEntities->internalEventPtr, - openInternalEntities->internalEventEndPtr); +XML_DefaultCurrent(XML_Parser parser) { + if (parser == NULL) + return; + if (parser->m_defaultHandler) { + if (parser->m_openInternalEntities) + reportDefault(parser, parser->m_internalEncoding, + parser->m_openInternalEntities->internalEventPtr, + parser->m_openInternalEntities->internalEventEndPtr); else - reportDefault(parser, encoding, eventPtr, eventEndPtr); + reportDefault(parser, parser->m_encoding, parser->m_eventPtr, + parser->m_eventEndPtr); } } -const XML_LChar * XMLCALL -XML_ErrorString(enum XML_Error code) -{ - static const XML_LChar* const message[] = { - 0, - XML_L("out of memory"), - XML_L("syntax error"), - XML_L("no element found"), - XML_L("not well-formed (invalid token)"), - XML_L("unclosed token"), - XML_L("partial character"), - XML_L("mismatched tag"), - XML_L("duplicate attribute"), - XML_L("junk after document element"), - XML_L("illegal parameter entity reference"), - XML_L("undefined entity"), - XML_L("recursive entity reference"), - XML_L("asynchronous entity"), - XML_L("reference to invalid character number"), - XML_L("reference to binary entity"), - XML_L("reference to external entity in attribute"), - XML_L("XML or text declaration not at start of entity"), - XML_L("unknown encoding"), - XML_L("encoding specified in XML declaration is incorrect"), - XML_L("unclosed CDATA section"), - XML_L("error in processing external entity reference"), - XML_L("document is not standalone"), - XML_L("unexpected parser state - please send a bug report"), - XML_L("entity declared in parameter entity"), - XML_L("requested feature requires XML_DTD support in Expat"), - XML_L("cannot change setting once parsing has begun"), - XML_L("unbound prefix"), - XML_L("must not undeclare prefix"), - XML_L("incomplete markup in parameter entity"), - XML_L("XML declaration not well-formed"), - XML_L("text declaration not well-formed"), - XML_L("illegal character(s) in public id"), - XML_L("parser suspended"), - XML_L("parser not suspended"), - XML_L("parsing aborted"), - XML_L("parsing finished"), - XML_L("cannot suspend in external parameter entity"), - XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"), - XML_L("reserved prefix (xmlns) must not be declared or undeclared"), - XML_L("prefix must not be bound to one of the reserved namespace names") - }; - if (code > 0 && code < sizeof(message)/sizeof(message[0])) - return message[code]; +const XML_LChar *XMLCALL +XML_ErrorString(enum XML_Error code) { + switch (code) { + case XML_ERROR_NONE: + return NULL; + case XML_ERROR_NO_MEMORY: + return XML_L("out of memory"); + case XML_ERROR_SYNTAX: + return XML_L("syntax error"); + case XML_ERROR_NO_ELEMENTS: + return XML_L("no element found"); + case XML_ERROR_INVALID_TOKEN: + return XML_L("not well-formed (invalid token)"); + case XML_ERROR_UNCLOSED_TOKEN: + return XML_L("unclosed token"); + case XML_ERROR_PARTIAL_CHAR: + return XML_L("partial character"); + case XML_ERROR_TAG_MISMATCH: + return XML_L("mismatched tag"); + case XML_ERROR_DUPLICATE_ATTRIBUTE: + return XML_L("duplicate attribute"); + case XML_ERROR_JUNK_AFTER_DOC_ELEMENT: + return XML_L("junk after document element"); + case XML_ERROR_PARAM_ENTITY_REF: + return XML_L("illegal parameter entity reference"); + case XML_ERROR_UNDEFINED_ENTITY: + return XML_L("undefined entity"); + case XML_ERROR_RECURSIVE_ENTITY_REF: + return XML_L("recursive entity reference"); + case XML_ERROR_ASYNC_ENTITY: + return XML_L("asynchronous entity"); + case XML_ERROR_BAD_CHAR_REF: + return XML_L("reference to invalid character number"); + case XML_ERROR_BINARY_ENTITY_REF: + return XML_L("reference to binary entity"); + case XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF: + return XML_L("reference to external entity in attribute"); + case XML_ERROR_MISPLACED_XML_PI: + return XML_L("XML or text declaration not at start of entity"); + case XML_ERROR_UNKNOWN_ENCODING: + return XML_L("unknown encoding"); + case XML_ERROR_INCORRECT_ENCODING: + return XML_L("encoding specified in XML declaration is incorrect"); + case XML_ERROR_UNCLOSED_CDATA_SECTION: + return XML_L("unclosed CDATA section"); + case XML_ERROR_EXTERNAL_ENTITY_HANDLING: + return XML_L("error in processing external entity reference"); + case XML_ERROR_NOT_STANDALONE: + return XML_L("document is not standalone"); + case XML_ERROR_UNEXPECTED_STATE: + return XML_L("unexpected parser state - please send a bug report"); + case XML_ERROR_ENTITY_DECLARED_IN_PE: + return XML_L("entity declared in parameter entity"); + case XML_ERROR_FEATURE_REQUIRES_XML_DTD: + return XML_L("requested feature requires XML_DTD support in Expat"); + case XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING: + return XML_L("cannot change setting once parsing has begun"); + /* Added in 1.95.7. */ + case XML_ERROR_UNBOUND_PREFIX: + return XML_L("unbound prefix"); + /* Added in 1.95.8. */ + case XML_ERROR_UNDECLARING_PREFIX: + return XML_L("must not undeclare prefix"); + case XML_ERROR_INCOMPLETE_PE: + return XML_L("incomplete markup in parameter entity"); + case XML_ERROR_XML_DECL: + return XML_L("XML declaration not well-formed"); + case XML_ERROR_TEXT_DECL: + return XML_L("text declaration not well-formed"); + case XML_ERROR_PUBLICID: + return XML_L("illegal character(s) in public id"); + case XML_ERROR_SUSPENDED: + return XML_L("parser suspended"); + case XML_ERROR_NOT_SUSPENDED: + return XML_L("parser not suspended"); + case XML_ERROR_ABORTED: + return XML_L("parsing aborted"); + case XML_ERROR_FINISHED: + return XML_L("parsing finished"); + case XML_ERROR_SUSPEND_PE: + return XML_L("cannot suspend in external parameter entity"); + /* Added in 2.0.0. */ + case XML_ERROR_RESERVED_PREFIX_XML: + return XML_L( + "reserved prefix (xml) must not be undeclared or bound to another namespace name"); + case XML_ERROR_RESERVED_PREFIX_XMLNS: + return XML_L("reserved prefix (xmlns) must not be declared or undeclared"); + case XML_ERROR_RESERVED_NAMESPACE_URI: + return XML_L( + "prefix must not be bound to one of the reserved namespace names"); + /* Added in 2.2.5. */ + case XML_ERROR_INVALID_ARGUMENT: /* Constant added in 2.2.1, already */ + return XML_L("invalid argument"); + /* Added in 2.3.0. */ + case XML_ERROR_NO_BUFFER: + return XML_L( + "a successful prior call to function XML_GetBuffer is required"); + /* Added in 2.4.0. */ + case XML_ERROR_AMPLIFICATION_LIMIT_BREACH: + return XML_L( + "limit on input amplification factor (from DTD and entities) breached"); + } return NULL; } -const XML_LChar * XMLCALL +const XML_LChar *XMLCALL XML_ExpatVersion(void) { - /* V1 is used to string-ize the version number. However, it would string-ize the actual version macro *names* unless we get them substituted before being passed to V1. CPP is defined to expand @@ -2027,8 +2466,8 @@ XML_ExpatVersion(void) { with the correct numerals. */ /* ### I'm assuming cpp is portable in this respect... */ -#define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c) -#define V2(a,b,c) XML_L("expat_")V1(a,b,c) +#define V1(a, b, c) XML_L(#a) XML_L(".") XML_L(#b) XML_L(".") XML_L(#c) +#define V2(a, b, c) XML_L("expat_") V1(a, b, c) return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); @@ -2037,8 +2476,7 @@ XML_ExpatVersion(void) { } XML_Expat_Version XMLCALL -XML_ExpatVersionInfo(void) -{ +XML_ExpatVersionInfo(void) { XML_Expat_Version version; version.major = XML_MAJOR_VERSION; @@ -2048,59 +2486,91 @@ XML_ExpatVersionInfo(void) return version; } -const XML_Feature * XMLCALL -XML_GetFeatureList(void) -{ +const XML_Feature *XMLCALL +XML_GetFeatureList(void) { static const XML_Feature features[] = { - {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"), - sizeof(XML_Char)}, - {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"), - sizeof(XML_LChar)}, + {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"), + sizeof(XML_Char)}, + {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"), + sizeof(XML_LChar)}, #ifdef XML_UNICODE - {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0}, + {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0}, #endif #ifdef XML_UNICODE_WCHAR_T - {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0}, + {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0}, #endif #ifdef XML_DTD - {XML_FEATURE_DTD, XML_L("XML_DTD"), 0}, + {XML_FEATURE_DTD, XML_L("XML_DTD"), 0}, #endif #ifdef XML_CONTEXT_BYTES - {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"), - XML_CONTEXT_BYTES}, + {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"), + XML_CONTEXT_BYTES}, #endif #ifdef XML_MIN_SIZE - {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0}, + {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0}, #endif #ifdef XML_NS - {XML_FEATURE_NS, XML_L("XML_NS"), 0}, + {XML_FEATURE_NS, XML_L("XML_NS"), 0}, #endif #ifdef XML_LARGE_SIZE - {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0}, + {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0}, #endif #ifdef XML_ATTR_INFO - {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0}, + {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0}, #endif - {XML_FEATURE_END, NULL, 0} - }; +#ifdef XML_DTD + /* Added in Expat 2.4.0. */ + {XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT, + XML_L("XML_BLAP_MAX_AMP"), + (long int) + EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_MAXIMUM_AMPLIFICATION_DEFAULT}, + {XML_FEATURE_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT, + XML_L("XML_BLAP_ACT_THRES"), + EXPAT_BILLION_LAUGHS_ATTACK_PROTECTION_ACTIVATION_THRESHOLD_DEFAULT}, +#endif + {XML_FEATURE_END, NULL, 0}}; return features; } +#ifdef XML_DTD +XML_Bool XMLCALL +XML_SetBillionLaughsAttackProtectionMaximumAmplification( + XML_Parser parser, float maximumAmplificationFactor) { + if ((parser == NULL) || (parser->m_parentParser != NULL) + || isnan(maximumAmplificationFactor) + || (maximumAmplificationFactor < 1.0f)) { + return XML_FALSE; + } + parser->m_accounting.maximumAmplificationFactor = maximumAmplificationFactor; + return XML_TRUE; +} + +XML_Bool XMLCALL +XML_SetBillionLaughsAttackProtectionActivationThreshold( + XML_Parser parser, unsigned long long activationThresholdBytes) { + if ((parser == NULL) || (parser->m_parentParser != NULL)) { + return XML_FALSE; + } + parser->m_accounting.activationThresholdBytes = activationThresholdBytes; + return XML_TRUE; +} +#endif /* XML_DTD */ + /* Initially tag->rawName always points into the parse buffer; for those TAG instances opened while the current parse buffer was processed, and not yet closed, we need to store tag->rawName in a more permanent location, since the parse buffer is about to be discarded. */ static XML_Bool -storeRawNames(XML_Parser parser) -{ - TAG *tag = tagStack; +storeRawNames(XML_Parser parser) { + TAG *tag = parser->m_tagStack; while (tag) { int bufSize; int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1); + size_t rawNameLen; char *rawNameBuf = tag->buf + nameLen; - /* Stop if already stored. Since tagStack is a stack, we can stop + /* Stop if already stored. Since m_tagStack is a stack, we can stop at the first entry that has already been copied; everything below it in the stack is already been accounted for in a previous call to this function. @@ -2110,9 +2580,13 @@ storeRawNames(XML_Parser parser) /* For re-use purposes we need to ensure that the size of tag->buf is a multiple of sizeof(XML_Char). */ - bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)); + rawNameLen = ROUND_UP(tag->rawNameLength, sizeof(XML_Char)); + /* Detect and prevent integer overflow. */ + if (rawNameLen > (size_t)INT_MAX - nameLen) + return XML_FALSE; + bufSize = nameLen + (int)rawNameLen; if (bufSize > tag->bufEnd - tag->buf) { - char *temp = (char *)REALLOC(tag->buf, bufSize); + char *temp = (char *)REALLOC(parser, tag->buf, bufSize); if (temp == NULL) return XML_FALSE; /* if tag->name.str points to tag->buf (only when namespace @@ -2124,8 +2598,8 @@ storeRawNames(XML_Parser parser) then update it as well, since it will always point into tag->buf */ if (tag->name.localPart) - tag->name.localPart = (XML_Char *)temp + (tag->name.localPart - - (XML_Char *)tag->buf); + tag->name.localPart + = (XML_Char *)temp + (tag->name.localPart - (XML_Char *)tag->buf); tag->buf = temp; tag->bufEnd = temp + bufSize; rawNameBuf = temp + nameLen; @@ -2138,163 +2612,166 @@ storeRawNames(XML_Parser parser) } static enum XML_Error PTRCALL -contentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doContent(parser, 0, encoding, start, end, - endPtr, (XML_Bool)!ps_finalBuffer); +contentProcessor(XML_Parser parser, const char *start, const char *end, + const char **endPtr) { + enum XML_Error result = doContent( + parser, 0, parser->m_encoding, start, end, endPtr, + (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_ACCOUNT_DIRECT); if (result == XML_ERROR_NONE) { - if (!storeRawNames(parser)) + if (! storeRawNames(parser)) return XML_ERROR_NO_MEMORY; } return result; } static enum XML_Error PTRCALL -externalEntityInitProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ +externalEntityInitProcessor(XML_Parser parser, const char *start, + const char *end, const char **endPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; - processor = externalEntityInitProcessor2; + parser->m_processor = externalEntityInitProcessor2; return externalEntityInitProcessor2(parser, start, end, endPtr); } static enum XML_Error PTRCALL -externalEntityInitProcessor2(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ +externalEntityInitProcessor2(XML_Parser parser, const char *start, + const char *end, const char **endPtr) { const char *next = start; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(encoding, start, end, &next); + int tok = XmlContentTok(parser->m_encoding, start, end, &next); switch (tok) { case XML_TOK_BOM: +#ifdef XML_DTD + if (! accountingDiffTolerated(parser, tok, start, next, __LINE__, + XML_ACCOUNT_DIRECT)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } +#endif /* XML_DTD */ + /* If we are at the end of the buffer, this would cause the next stage, i.e. externalEntityInitProcessor3, to pass control directly to doContent (by detecting XML_TOK_NONE) without processing any xml text declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. */ - if (next == end && !ps_finalBuffer) { + if (next == end && ! parser->m_parsingStatus.finalBuffer) { *endPtr = next; return XML_ERROR_NONE; } start = next; break; case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { + if (! parser->m_parsingStatus.finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } - eventPtr = start; + parser->m_eventPtr = start; return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { + if (! parser->m_parsingStatus.finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } - eventPtr = start; + parser->m_eventPtr = start; return XML_ERROR_PARTIAL_CHAR; } - processor = externalEntityInitProcessor3; + parser->m_processor = externalEntityInitProcessor3; return externalEntityInitProcessor3(parser, start, end, endPtr); } static enum XML_Error PTRCALL -externalEntityInitProcessor3(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ +externalEntityInitProcessor3(XML_Parser parser, const char *start, + const char *end, const char **endPtr) { int tok; const char *next = start; /* XmlContentTok doesn't always set the last arg */ - eventPtr = start; - tok = XmlContentTok(encoding, start, end, &next); - eventEndPtr = next; + parser->m_eventPtr = start; + tok = XmlContentTok(parser->m_encoding, start, end, &next); + /* Note: These bytes are accounted later in: + - processXmlDecl + - externalEntityContentProcessor + */ + parser->m_eventEndPtr = next; switch (tok) { - case XML_TOK_XML_DECL: - { - enum XML_Error result; - result = processXmlDecl(parser, 1, start, next); - if (result != XML_ERROR_NONE) - return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *endPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - start = next; - } + case XML_TOK_XML_DECL: { + enum XML_Error result; + result = processXmlDecl(parser, 1, start, next); + if (result != XML_ERROR_NONE) + return result; + switch (parser->m_parsingStatus.parsing) { + case XML_SUSPENDED: + *endPtr = next; + return XML_ERROR_NONE; + case XML_FINISHED: + return XML_ERROR_ABORTED; + default: + start = next; } - break; + } break; case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { + if (! parser->m_parsingStatus.finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { + if (! parser->m_parsingStatus.finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; } - processor = externalEntityContentProcessor; - tagLevel = 1; + parser->m_processor = externalEntityContentProcessor; + parser->m_tagLevel = 1; return externalEntityContentProcessor(parser, start, end, endPtr); } static enum XML_Error PTRCALL -externalEntityContentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doContent(parser, 1, encoding, start, end, - endPtr, (XML_Bool)!ps_finalBuffer); +externalEntityContentProcessor(XML_Parser parser, const char *start, + const char *end, const char **endPtr) { + enum XML_Error result + = doContent(parser, 1, parser->m_encoding, start, end, endPtr, + (XML_Bool)! parser->m_parsingStatus.finalBuffer, + XML_ACCOUNT_ENTITY_EXPANSION); if (result == XML_ERROR_NONE) { - if (!storeRawNames(parser)) + if (! storeRawNames(parser)) return XML_ERROR_NO_MEMORY; } return result; } static enum XML_Error -doContent(XML_Parser parser, - int startTagLevel, - const ENCODING *enc, - const char *s, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ +doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, + const char *s, const char *end, const char **nextPtr, + XML_Bool haveMore, enum XML_Account account) { /* save one level of indirection */ - DTD * const dtd = _dtd; + DTD *const dtd = parser->m_dtd; const char **eventPP; const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); + if (enc == parser->m_encoding) { + eventPP = &parser->m_eventPtr; + eventEndPP = &parser->m_eventEndPtr; + } else { + eventPP = &(parser->m_openInternalEntities->internalEventPtr); + eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr); } *eventPP = s; for (;;) { const char *next = s; /* XmlContentTok doesn't always set the last arg */ int tok = XmlContentTok(enc, s, end, &next); +#ifdef XML_DTD + const char *accountAfter + = ((tok == XML_TOK_TRAILING_RSQB) || (tok == XML_TOK_TRAILING_CR)) + ? (haveMore ? s /* i.e. 0 bytes */ : end) + : next; + if (! accountingDiffTolerated(parser, tok, s, accountAfter, __LINE__, + account)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } +#endif *eventEndPP = next; switch (tok) { case XML_TOK_TRAILING_CR: @@ -2303,18 +2780,17 @@ doContent(XML_Parser parser, return XML_ERROR_NONE; } *eventEndPP = end; - if (characterDataHandler) { + if (parser->m_characterDataHandler) { XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) + parser->m_characterDataHandler(parser->m_handlerArg, &c, 1); + } else if (parser->m_defaultHandler) reportDefault(parser, enc, s, end); /* We are at the end of the final buffer, should we check for XML_SUSPENDED, XML_FINISHED? */ if (startTagLevel == 0) return XML_ERROR_NO_ELEMENTS; - if (tagLevel != startTagLevel) + if (parser->m_tagLevel != startTagLevel) return XML_ERROR_ASYNC_ENTITY; *nextPtr = end; return XML_ERROR_NONE; @@ -2324,7 +2800,7 @@ doContent(XML_Parser parser, return XML_ERROR_NONE; } if (startTagLevel > 0) { - if (tagLevel != startTagLevel) + if (parser->m_tagLevel != startTagLevel) return XML_ERROR_ASYNC_ENTITY; *nextPtr = s; return XML_ERROR_NONE; @@ -2345,321 +2821,325 @@ doContent(XML_Parser parser, return XML_ERROR_NONE; } return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (characterDataHandler) - characterDataHandler(handlerArg, &ch, 1); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - name = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); - poolDiscard(&dtd->pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity or default handler. - */ - if (!dtd->hasParamEntityRefs || dtd->standalone) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->notation) - return XML_ERROR_BINARY_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - if (!defaultExpandInternalEntities) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, entity->name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - result = processInternalEntity(parser, entity, XML_FALSE); - if (result != XML_ERROR_NONE) - return result; - } - else if (externalEntityRefHandler) { - const XML_Char *context; - entity->open = XML_TRUE; - context = getContext(parser); - entity->open = XML_FALSE; - if (!context) - return XML_ERROR_NO_MEMORY; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - context, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - poolDiscard(&tempPool); - } - else if (defaultHandler) + case XML_TOK_ENTITY_REF: { + const XML_Char *name; + ENTITY *entity; + XML_Char ch = (XML_Char)XmlPredefinedEntityName( + enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); + if (ch) { +#ifdef XML_DTD + /* NOTE: We are replacing 4-6 characters original input for 1 character + * so there is no amplification and hence recording without + * protection. */ + accountingDiffTolerated(parser, tok, (char *)&ch, + ((char *)&ch) + sizeof(XML_Char), __LINE__, + XML_ACCOUNT_ENTITY_EXPANSION); +#endif /* XML_DTD */ + if (parser->m_characterDataHandler) + parser->m_characterDataHandler(parser->m_handlerArg, &ch, 1); + else if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); break; } + name = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (! name) + return XML_ERROR_NO_MEMORY; + entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); + poolDiscard(&dtd->pool); + /* First, determine if a check for an existing declaration is needed; + if yes, check that the entity exists, and that it is internal, + otherwise call the skipped entity or default handler. + */ + if (! dtd->hasParamEntityRefs || dtd->standalone) { + if (! entity) + return XML_ERROR_UNDEFINED_ENTITY; + else if (! entity->is_internal) + return XML_ERROR_ENTITY_DECLARED_IN_PE; + } else if (! entity) { + if (parser->m_skippedEntityHandler) + parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0); + else if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + if (entity->open) + return XML_ERROR_RECURSIVE_ENTITY_REF; + if (entity->notation) + return XML_ERROR_BINARY_ENTITY_REF; + if (entity->textPtr) { + enum XML_Error result; + if (! parser->m_defaultExpandInternalEntities) { + if (parser->m_skippedEntityHandler) + parser->m_skippedEntityHandler(parser->m_handlerArg, entity->name, + 0); + else if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + break; + } + result = processInternalEntity(parser, entity, XML_FALSE); + if (result != XML_ERROR_NONE) + return result; + } else if (parser->m_externalEntityRefHandler) { + const XML_Char *context; + entity->open = XML_TRUE; + context = getContext(parser); + entity->open = XML_FALSE; + if (! context) + return XML_ERROR_NO_MEMORY; + if (! parser->m_externalEntityRefHandler( + parser->m_externalEntityRefHandlerArg, context, entity->base, + entity->systemId, entity->publicId)) + return XML_ERROR_EXTERNAL_ENTITY_HANDLING; + poolDiscard(&parser->m_tempPool); + } else if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + break; + } case XML_TOK_START_TAG_NO_ATTS: /* fall through */ - case XML_TOK_START_TAG_WITH_ATTS: - { - TAG *tag; - enum XML_Error result; - XML_Char *toPtr; - if (freeTagList) { - tag = freeTagList; - freeTagList = freeTagList->parent; + case XML_TOK_START_TAG_WITH_ATTS: { + TAG *tag; + enum XML_Error result; + XML_Char *toPtr; + if (parser->m_freeTagList) { + tag = parser->m_freeTagList; + parser->m_freeTagList = parser->m_freeTagList->parent; + } else { + tag = (TAG *)MALLOC(parser, sizeof(TAG)); + if (! tag) + return XML_ERROR_NO_MEMORY; + tag->buf = (char *)MALLOC(parser, INIT_TAG_BUF_SIZE); + if (! tag->buf) { + FREE(parser, tag); + return XML_ERROR_NO_MEMORY; } - else { - tag = (TAG *)MALLOC(sizeof(TAG)); - if (!tag) - return XML_ERROR_NO_MEMORY; - tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE); - if (!tag->buf) { - FREE(tag); - return XML_ERROR_NO_MEMORY; - } - tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; - } - tag->bindings = NULL; - tag->parent = tagStack; - tagStack = tag; - tag->name.localPart = NULL; - tag->name.prefix = NULL; - tag->rawName = s + enc->minBytesPerChar; - tag->rawNameLength = XmlNameLength(enc, tag->rawName); - ++tagLevel; - { - const char *rawNameEnd = tag->rawName + tag->rawNameLength; - const char *fromPtr = tag->rawName; - toPtr = (XML_Char *)tag->buf; - for (;;) { - int bufSize; - int convLen; - const enum XML_Convert_Result convert_res = XmlConvert(enc, - &fromPtr, rawNameEnd, - (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); - convLen = (int)(toPtr - (XML_Char *)tag->buf); - if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) { - tag->name.strLen = convLen; - break; - } - bufSize = (int)(tag->bufEnd - tag->buf) << 1; - { - char *temp = (char *)REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - tag->buf = temp; - tag->bufEnd = temp + bufSize; - toPtr = (XML_Char *)temp + convLen; - } - } - } - tag->name.str = (XML_Char *)tag->buf; - *toPtr = XML_T('\0'); - result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); - if (result) - return result; - if (startElementHandler) - startElementHandler(handlerArg, tag->name.str, - (const XML_Char **)atts); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - break; + tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; } + tag->bindings = NULL; + tag->parent = parser->m_tagStack; + parser->m_tagStack = tag; + tag->name.localPart = NULL; + tag->name.prefix = NULL; + tag->rawName = s + enc->minBytesPerChar; + tag->rawNameLength = XmlNameLength(enc, tag->rawName); + ++parser->m_tagLevel; + { + const char *rawNameEnd = tag->rawName + tag->rawNameLength; + const char *fromPtr = tag->rawName; + toPtr = (XML_Char *)tag->buf; + for (;;) { + int bufSize; + int convLen; + const enum XML_Convert_Result convert_res + = XmlConvert(enc, &fromPtr, rawNameEnd, (ICHAR **)&toPtr, + (ICHAR *)tag->bufEnd - 1); + convLen = (int)(toPtr - (XML_Char *)tag->buf); + if ((fromPtr >= rawNameEnd) + || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) { + tag->name.strLen = convLen; + break; + } + bufSize = (int)(tag->bufEnd - tag->buf) << 1; + { + char *temp = (char *)REALLOC(parser, tag->buf, bufSize); + if (temp == NULL) + return XML_ERROR_NO_MEMORY; + tag->buf = temp; + tag->bufEnd = temp + bufSize; + toPtr = (XML_Char *)temp + convLen; + } + } + } + tag->name.str = (XML_Char *)tag->buf; + *toPtr = XML_T('\0'); + result + = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings), account); + if (result) + return result; + if (parser->m_startElementHandler) + parser->m_startElementHandler(parser->m_handlerArg, tag->name.str, + (const XML_Char **)parser->m_atts); + else if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + poolClear(&parser->m_tempPool); + break; + } case XML_TOK_EMPTY_ELEMENT_NO_ATTS: /* fall through */ - case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: - { - const char *rawName = s + enc->minBytesPerChar; - enum XML_Error result; - BINDING *bindings = NULL; - XML_Bool noElmHandlers = XML_TRUE; - TAG_NAME name; - name.str = poolStoreString(&tempPool, enc, rawName, - rawName + XmlNameLength(enc, rawName)); - if (!name.str) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - result = storeAtts(parser, enc, s, &name, &bindings); - if (result) - return result; - poolFinish(&tempPool); - if (startElementHandler) { - startElementHandler(handlerArg, name.str, (const XML_Char **)atts); - noElmHandlers = XML_FALSE; - } - if (endElementHandler) { - if (startElementHandler) - *eventPP = *eventEndPP; - endElementHandler(handlerArg, name.str); - noElmHandlers = XML_FALSE; - } - if (noElmHandlers && defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - while (bindings) { - BINDING *b = bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } + case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: { + const char *rawName = s + enc->minBytesPerChar; + enum XML_Error result; + BINDING *bindings = NULL; + XML_Bool noElmHandlers = XML_TRUE; + TAG_NAME name; + name.str = poolStoreString(&parser->m_tempPool, enc, rawName, + rawName + XmlNameLength(enc, rawName)); + if (! name.str) + return XML_ERROR_NO_MEMORY; + poolFinish(&parser->m_tempPool); + result = storeAtts(parser, enc, s, &name, &bindings, + XML_ACCOUNT_NONE /* token spans whole start tag */); + if (result != XML_ERROR_NONE) { + freeBindings(parser, bindings); + return result; + } + poolFinish(&parser->m_tempPool); + if (parser->m_startElementHandler) { + parser->m_startElementHandler(parser->m_handlerArg, name.str, + (const XML_Char **)parser->m_atts); + noElmHandlers = XML_FALSE; + } + if (parser->m_endElementHandler) { + if (parser->m_startElementHandler) + *eventPP = *eventEndPP; + parser->m_endElementHandler(parser->m_handlerArg, name.str); + noElmHandlers = XML_FALSE; + } + if (noElmHandlers && parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + poolClear(&parser->m_tempPool); + freeBindings(parser, bindings); + } + if ((parser->m_tagLevel == 0) + && (parser->m_parsingStatus.parsing != XML_FINISHED)) { + if (parser->m_parsingStatus.parsing == XML_SUSPENDED) + parser->m_processor = epilogProcessor; + else + return epilogProcessor(parser, next, end, nextPtr); } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); break; case XML_TOK_END_TAG: - if (tagLevel == startTagLevel) + if (parser->m_tagLevel == startTagLevel) return XML_ERROR_ASYNC_ENTITY; else { int len; const char *rawName; - TAG *tag = tagStack; - tagStack = tag->parent; - tag->parent = freeTagList; - freeTagList = tag; - rawName = s + enc->minBytesPerChar*2; + TAG *tag = parser->m_tagStack; + rawName = s + enc->minBytesPerChar * 2; len = XmlNameLength(enc, rawName); if (len != tag->rawNameLength || memcmp(tag->rawName, rawName, len) != 0) { *eventPP = rawName; return XML_ERROR_TAG_MISMATCH; } - --tagLevel; - if (endElementHandler) { + parser->m_tagStack = tag->parent; + tag->parent = parser->m_freeTagList; + parser->m_freeTagList = tag; + --parser->m_tagLevel; + if (parser->m_endElementHandler) { const XML_Char *localPart; const XML_Char *prefix; XML_Char *uri; localPart = tag->name.localPart; - if (ns && localPart) { + if (parser->m_ns && localPart) { /* localPart and prefix may have been overwritten in tag->name.str, since this points to the binding->uri buffer which gets re-used; so we have to add them again */ uri = (XML_Char *)tag->name.str + tag->name.uriLen; /* don't need to check for space - already done in storeAtts() */ - while (*localPart) *uri++ = *localPart++; + while (*localPart) + *uri++ = *localPart++; prefix = (XML_Char *)tag->name.prefix; - if (ns_triplets && prefix) { - *uri++ = namespaceSeparator; - while (*prefix) *uri++ = *prefix++; - } + if (parser->m_ns_triplets && prefix) { + *uri++ = parser->m_namespaceSeparator; + while (*prefix) + *uri++ = *prefix++; + } *uri = XML_T('\0'); } - endElementHandler(handlerArg, tag->name.str); - } - else if (defaultHandler) + parser->m_endElementHandler(parser->m_handlerArg, tag->name.str); + } else if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); while (tag->bindings) { BINDING *b = tag->bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); + if (parser->m_endNamespaceDeclHandler) + parser->m_endNamespaceDeclHandler(parser->m_handlerArg, + b->prefix->name); tag->bindings = tag->bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; + b->nextTagBinding = parser->m_freeBindingList; + parser->m_freeBindingList = b; b->prefix->binding = b->prevPrefixBinding; } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - } - break; - case XML_TOK_CHAR_REF: - { - int n = XmlCharRefNumber(enc, s); - if (n < 0) - return XML_ERROR_BAD_CHAR_REF; - if (characterDataHandler) { - XML_Char buf[XML_ENCODE_MAX]; - characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); + if ((parser->m_tagLevel == 0) + && (parser->m_parsingStatus.parsing != XML_FINISHED)) { + if (parser->m_parsingStatus.parsing == XML_SUSPENDED) + parser->m_processor = epilogProcessor; + else + return epilogProcessor(parser, next, end, nextPtr); } - else if (defaultHandler) - reportDefault(parser, enc, s, next); } break; + case XML_TOK_CHAR_REF: { + int n = XmlCharRefNumber(enc, s); + if (n < 0) + return XML_ERROR_BAD_CHAR_REF; + if (parser->m_characterDataHandler) { + XML_Char buf[XML_ENCODE_MAX]; + parser->m_characterDataHandler(parser->m_handlerArg, buf, + XmlEncode(n, (ICHAR *)buf)); + } else if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + } break; case XML_TOK_XML_DECL: return XML_ERROR_MISPLACED_XML_PI; case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { + if (parser->m_characterDataHandler) { XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) + parser->m_characterDataHandler(parser->m_handlerArg, &c, 1); + } else if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); break; - case XML_TOK_CDATA_SECT_OPEN: - { - enum XML_Error result; - if (startCdataSectionHandler) - startCdataSectionHandler(handlerArg); -#if 0 - /* Suppose you doing a transformation on a document that involves - changing only the character data. You set up a defaultHandler - and a characterDataHandler. The defaultHandler simply copies - characters through. The characterDataHandler does the - transformation and writes the characters out escaping them as - necessary. This case will fail to work if we leave out the - following two lines (because & and < inside CDATA sections will - be incorrectly escaped). + case XML_TOK_CDATA_SECT_OPEN: { + enum XML_Error result; + if (parser->m_startCdataSectionHandler) + parser->m_startCdataSectionHandler(parser->m_handlerArg); + /* BEGIN disabled code */ + /* Suppose you doing a transformation on a document that involves + changing only the character data. You set up a defaultHandler + and a characterDataHandler. The defaultHandler simply copies + characters through. The characterDataHandler does the + transformation and writes the characters out escaping them as + necessary. This case will fail to work if we leave out the + following two lines (because & and < inside CDATA sections will + be incorrectly escaped). - However, now we have a start/endCdataSectionHandler, so it seems - easier to let the user deal with this. - */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore); - if (result != XML_ERROR_NONE) - return result; - else if (!next) { - processor = cdataSectionProcessor; - return result; - } + However, now we have a start/endCdataSectionHandler, so it seems + easier to let the user deal with this. + */ + else if (0 && parser->m_characterDataHandler) + parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, + 0); + /* END disabled code */ + else if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + result + = doCdataSection(parser, enc, &next, end, nextPtr, haveMore, account); + if (result != XML_ERROR_NONE) + return result; + else if (! next) { + parser->m_processor = cdataSectionProcessor; + return result; } - break; + } break; case XML_TOK_TRAILING_RSQB: if (haveMore) { *nextPtr = s; return XML_ERROR_NONE; } - if (characterDataHandler) { + if (parser->m_characterDataHandler) { if (MUST_CONVERT(enc, s)) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - characterDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)end - (XML_Char *)s)); - } - else if (defaultHandler) + ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf; + XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)parser->m_dataBufEnd); + parser->m_characterDataHandler( + parser->m_handlerArg, parser->m_dataBuf, + (int)(dataPtr - (ICHAR *)parser->m_dataBuf)); + } else + parser->m_characterDataHandler( + parser->m_handlerArg, (XML_Char *)s, + (int)((XML_Char *)end - (XML_Char *)s)); + } else if (parser->m_defaultHandler) reportDefault(parser, enc, s, end); /* We are at the end of the final buffer, should we check for XML_SUSPENDED, XML_FINISHED? @@ -2668,63 +3148,90 @@ doContent(XML_Parser parser, *eventPP = end; return XML_ERROR_NO_ELEMENTS; } - if (tagLevel != startTagLevel) { + if (parser->m_tagLevel != startTagLevel) { *eventPP = end; return XML_ERROR_ASYNC_ENTITY; } *nextPtr = end; return XML_ERROR_NONE; - case XML_TOK_DATA_CHARS: - { - XML_CharacterDataHandler charDataHandler = characterDataHandler; - if (charDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - charDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) - break; - *eventPP = s; - } + case XML_TOK_DATA_CHARS: { + XML_CharacterDataHandler charDataHandler = parser->m_characterDataHandler; + if (charDataHandler) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf; + const enum XML_Convert_Result convert_res = XmlConvert( + enc, &s, next, &dataPtr, (ICHAR *)parser->m_dataBufEnd); + *eventEndPP = s; + charDataHandler(parser->m_handlerArg, parser->m_dataBuf, + (int)(dataPtr - (ICHAR *)parser->m_dataBuf)); + if ((convert_res == XML_CONVERT_COMPLETED) + || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) + break; + *eventPP = s; } - else - charDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; + } else + charDataHandler(parser->m_handlerArg, (XML_Char *)s, + (int)((XML_Char *)next - (XML_Char *)s)); + } else if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + } break; case XML_TOK_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) + if (! reportProcessingInstruction(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_COMMENT: - if (!reportComment(parser, enc, s, next)) + if (! reportComment(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; break; default: - if (defaultHandler) + /* All of the tokens produced by XmlContentTok() have their own + * explicit cases, so this default is not strictly necessary. + * However it is a useful safety net, so we retain the code and + * simply exclude it from the coverage tests. + * + * LCOV_EXCL_START + */ + if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); break; + /* LCOV_EXCL_STOP */ } *eventPP = s = next; - switch (ps_parsing) { + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; - default: ; + default:; } } /* not reached */ } +/* This function does not call free() on the allocated memory, merely + * moving it to the parser's m_freeBindingList where it can be freed or + * reused as appropriate. + */ +static void +freeBindings(XML_Parser parser, BINDING *bindings) { + while (bindings) { + BINDING *b = bindings; + + /* m_startNamespaceDeclHandler will have been called for this + * binding in addBindings(), so call the end handler now. + */ + if (parser->m_endNamespaceDeclHandler) + parser->m_endNamespaceDeclHandler(parser->m_handlerArg, b->prefix->name); + + bindings = bindings->nextTagBinding; + b->nextTagBinding = parser->m_freeBindingList; + parser->m_freeBindingList = b; + b->prefix->binding = b->prevPrefixBinding; + } +} + /* Precondition: all arguments must be non-NULL; Purpose: - normalize attributes @@ -2736,14 +3243,13 @@ doContent(XML_Parser parser, - generate namespace aware element name (URI, prefix) */ static enum XML_Error -storeAtts(XML_Parser parser, const ENCODING *enc, - const char *attStr, TAG_NAME *tagNamePtr, - BINDING **bindingsPtr) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ +storeAtts(XML_Parser parser, const ENCODING *enc, const char *attStr, + TAG_NAME *tagNamePtr, BINDING **bindingsPtr, + enum XML_Account account) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ ELEMENT_TYPE *elementType; int nDefaultAtts; - const XML_Char **appAtts; /* the attribute list for the application */ + const XML_Char **appAtts; /* the attribute list for the application */ int attIndex = 0; int prefixLen; int i; @@ -2754,75 +3260,120 @@ storeAtts(XML_Parser parser, const ENCODING *enc, const XML_Char *localPart; /* lookup the element type name */ - elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, tagNamePtr->str,0); - if (!elementType) { + elementType + = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, tagNamePtr->str, 0); + if (! elementType) { const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str); - if (!name) + if (! name) return XML_ERROR_NO_MEMORY; elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name, sizeof(ELEMENT_TYPE)); - if (!elementType) + if (! elementType) return XML_ERROR_NO_MEMORY; - if (ns && !setElementTypePrefix(parser, elementType)) + if (parser->m_ns && ! setElementTypePrefix(parser, elementType)) return XML_ERROR_NO_MEMORY; } nDefaultAtts = elementType->nDefaultAtts; /* get the attributes from the tokenizer */ - n = XmlGetAttributes(enc, attStr, attsSize, atts); - if (n + nDefaultAtts > attsSize) { - int oldAttsSize = attsSize; + n = XmlGetAttributes(enc, attStr, parser->m_attsSize, parser->m_atts); + + /* Detect and prevent integer overflow */ + if (n > INT_MAX - nDefaultAtts) { + return XML_ERROR_NO_MEMORY; + } + + if (n + nDefaultAtts > parser->m_attsSize) { + int oldAttsSize = parser->m_attsSize; ATTRIBUTE *temp; #ifdef XML_ATTR_INFO XML_AttrInfo *temp2; #endif - attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; - temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); - if (temp == NULL) + + /* Detect and prevent integer overflow */ + if ((nDefaultAtts > INT_MAX - INIT_ATTS_SIZE) + || (n > INT_MAX - (nDefaultAtts + INIT_ATTS_SIZE))) { return XML_ERROR_NO_MEMORY; - atts = temp; + } + + parser->m_attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; + + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if ((unsigned)parser->m_attsSize > (size_t)(-1) / sizeof(ATTRIBUTE)) { + parser->m_attsSize = oldAttsSize; + return XML_ERROR_NO_MEMORY; + } +#endif + + temp = (ATTRIBUTE *)REALLOC(parser, (void *)parser->m_atts, + parser->m_attsSize * sizeof(ATTRIBUTE)); + if (temp == NULL) { + parser->m_attsSize = oldAttsSize; + return XML_ERROR_NO_MEMORY; + } + parser->m_atts = temp; #ifdef XML_ATTR_INFO - temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo)); - if (temp2 == NULL) + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +# if UINT_MAX >= SIZE_MAX + if ((unsigned)parser->m_attsSize > (size_t)(-1) / sizeof(XML_AttrInfo)) { + parser->m_attsSize = oldAttsSize; return XML_ERROR_NO_MEMORY; - attInfo = temp2; + } +# endif + + temp2 = (XML_AttrInfo *)REALLOC(parser, (void *)parser->m_attInfo, + parser->m_attsSize * sizeof(XML_AttrInfo)); + if (temp2 == NULL) { + parser->m_attsSize = oldAttsSize; + return XML_ERROR_NO_MEMORY; + } + parser->m_attInfo = temp2; #endif if (n > oldAttsSize) - XmlGetAttributes(enc, attStr, n, atts); + XmlGetAttributes(enc, attStr, n, parser->m_atts); } - appAtts = (const XML_Char **)atts; + appAtts = (const XML_Char **)parser->m_atts; for (i = 0; i < n; i++) { - ATTRIBUTE *currAtt = &atts[i]; + ATTRIBUTE *currAtt = &parser->m_atts[i]; #ifdef XML_ATTR_INFO - XML_AttrInfo *currAttInfo = &attInfo[i]; + XML_AttrInfo *currAttInfo = &parser->m_attInfo[i]; #endif /* add the name and value to the attribute list */ - ATTRIBUTE_ID *attId = getAttributeId(parser, enc, currAtt->name, - currAtt->name - + XmlNameLength(enc, currAtt->name)); - if (!attId) + ATTRIBUTE_ID *attId + = getAttributeId(parser, enc, currAtt->name, + currAtt->name + XmlNameLength(enc, currAtt->name)); + if (! attId) return XML_ERROR_NO_MEMORY; #ifdef XML_ATTR_INFO - currAttInfo->nameStart = parseEndByteIndex - (parseEndPtr - currAtt->name); - currAttInfo->nameEnd = currAttInfo->nameStart + - XmlNameLength(enc, currAtt->name); - currAttInfo->valueStart = parseEndByteIndex - - (parseEndPtr - currAtt->valuePtr); - currAttInfo->valueEnd = parseEndByteIndex - (parseEndPtr - currAtt->valueEnd); + currAttInfo->nameStart + = parser->m_parseEndByteIndex - (parser->m_parseEndPtr - currAtt->name); + currAttInfo->nameEnd + = currAttInfo->nameStart + XmlNameLength(enc, currAtt->name); + currAttInfo->valueStart = parser->m_parseEndByteIndex + - (parser->m_parseEndPtr - currAtt->valuePtr); + currAttInfo->valueEnd = parser->m_parseEndByteIndex + - (parser->m_parseEndPtr - currAtt->valueEnd); #endif /* Detect duplicate attributes by their QNames. This does not work when namespace processing is turned on and different prefixes for the same namespace are used. For this case we have a check further down. */ if ((attId->name)[-1]) { - if (enc == encoding) - eventPtr = atts[i].name; + if (enc == parser->m_encoding) + parser->m_eventPtr = parser->m_atts[i].name; return XML_ERROR_DUPLICATE_ATTRIBUTE; } (attId->name)[-1] = 1; appAtts[attIndex++] = attId->name; - if (!atts[i].normalized) { + if (! parser->m_atts[i].normalized) { enum XML_Error result; XML_Bool isCdata = XML_TRUE; @@ -2838,21 +3389,21 @@ storeAtts(XML_Parser parser, const ENCODING *enc, } /* normalize the attribute value */ - result = storeAttributeValue(parser, enc, isCdata, - atts[i].valuePtr, atts[i].valueEnd, - &tempPool); + result = storeAttributeValue( + parser, enc, isCdata, parser->m_atts[i].valuePtr, + parser->m_atts[i].valueEnd, &parser->m_tempPool, account); if (result) return result; - appAtts[attIndex] = poolStart(&tempPool); - poolFinish(&tempPool); - } - else { + appAtts[attIndex] = poolStart(&parser->m_tempPool); + poolFinish(&parser->m_tempPool); + } else { /* the value did not need normalizing */ - appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, - atts[i].valueEnd); + appAtts[attIndex] = poolStoreString(&parser->m_tempPool, enc, + parser->m_atts[i].valuePtr, + parser->m_atts[i].valueEnd); if (appAtts[attIndex] == 0) return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); + poolFinish(&parser->m_tempPool); } /* handle prefixed attribute names */ if (attId->prefix) { @@ -2863,49 +3414,44 @@ storeAtts(XML_Parser parser, const ENCODING *enc, if (result) return result; --attIndex; - } - else { + } else { /* deal with other prefixed names later */ attIndex++; nPrefixes++; (attId->name)[-1] = 2; } - } - else + } else attIndex++; } /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */ - nSpecifiedAtts = attIndex; + parser->m_nSpecifiedAtts = attIndex; if (elementType->idAtt && (elementType->idAtt->name)[-1]) { for (i = 0; i < attIndex; i += 2) if (appAtts[i] == elementType->idAtt->name) { - idAttIndex = i; + parser->m_idAttIndex = i; break; } - } - else - idAttIndex = -1; + } else + parser->m_idAttIndex = -1; /* do attribute defaulting */ for (i = 0; i < nDefaultAtts; i++) { const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + i; - if (!(da->id->name)[-1] && da->value) { + if (! (da->id->name)[-1] && da->value) { if (da->id->prefix) { if (da->id->xmlns) { enum XML_Error result = addBinding(parser, da->id->prefix, da->id, da->value, bindingsPtr); if (result) return result; - } - else { + } else { (da->id->name)[-1] = 2; nPrefixes++; appAtts[attIndex++] = da->id->name; appAtts[attIndex++] = da->value; } - } - else { + } else { (da->id->name)[-1] = 1; appAtts[attIndex++] = da->id->name; appAtts[attIndex++] = da->value; @@ -2918,110 +3464,169 @@ storeAtts(XML_Parser parser, const ENCODING *enc, and clear flags that say whether attributes were specified */ i = 0; if (nPrefixes) { - int j; /* hash table index */ - unsigned long version = nsAttsVersion; - int nsAttsSize = (int)1 << nsAttsPower; + int j; /* hash table index */ + unsigned long version = parser->m_nsAttsVersion; + + /* Detect and prevent invalid shift */ + if (parser->m_nsAttsPower >= sizeof(unsigned int) * 8 /* bits per byte */) { + return XML_ERROR_NO_MEMORY; + } + + unsigned int nsAttsSize = 1u << parser->m_nsAttsPower; + unsigned char oldNsAttsPower = parser->m_nsAttsPower; /* size of hash table must be at least 2 * (# of prefixed attributes) */ - if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */ + if ((nPrefixes << 1) + >> parser->m_nsAttsPower) { /* true for m_nsAttsPower = 0 */ NS_ATT *temp; /* hash table size must also be a power of 2 and >= 8 */ - while (nPrefixes >> nsAttsPower++); - if (nsAttsPower < 3) - nsAttsPower = 3; - nsAttsSize = (int)1 << nsAttsPower; - temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT)); - if (!temp) + while (nPrefixes >> parser->m_nsAttsPower++) + ; + if (parser->m_nsAttsPower < 3) + parser->m_nsAttsPower = 3; + + /* Detect and prevent invalid shift */ + if (parser->m_nsAttsPower >= sizeof(nsAttsSize) * 8 /* bits per byte */) { + /* Restore actual size of memory in m_nsAtts */ + parser->m_nsAttsPower = oldNsAttsPower; return XML_ERROR_NO_MEMORY; - nsAtts = temp; - version = 0; /* force re-initialization of nsAtts hash table */ + } + + nsAttsSize = 1u << parser->m_nsAttsPower; + + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if (nsAttsSize > (size_t)(-1) / sizeof(NS_ATT)) { + /* Restore actual size of memory in m_nsAtts */ + parser->m_nsAttsPower = oldNsAttsPower; + return XML_ERROR_NO_MEMORY; + } +#endif + + temp = (NS_ATT *)REALLOC(parser, parser->m_nsAtts, + nsAttsSize * sizeof(NS_ATT)); + if (! temp) { + /* Restore actual size of memory in m_nsAtts */ + parser->m_nsAttsPower = oldNsAttsPower; + return XML_ERROR_NO_MEMORY; + } + parser->m_nsAtts = temp; + version = 0; /* force re-initialization of m_nsAtts hash table */ } - /* using a version flag saves us from initializing nsAtts every time */ - if (!version) { /* initialize version flags when version wraps around */ + /* using a version flag saves us from initializing m_nsAtts every time */ + if (! version) { /* initialize version flags when version wraps around */ version = INIT_ATTS_VERSION; - for (j = nsAttsSize; j != 0; ) - nsAtts[--j].version = version; + for (j = nsAttsSize; j != 0;) + parser->m_nsAtts[--j].version = version; } - nsAttsVersion = --version; + parser->m_nsAttsVersion = --version; /* expand prefixed names and check for duplicates */ for (; i < attIndex; i += 2) { const XML_Char *s = appAtts[i]; - if (s[-1] == 2) { /* prefixed */ + if (s[-1] == 2) { /* prefixed */ ATTRIBUTE_ID *id; const BINDING *b; - unsigned long uriHash = hash_secret_salt; - ((XML_Char *)s)[-1] = 0; /* clear flag */ + unsigned long uriHash; + struct siphash sip_state; + struct sipkey sip_key; + + copy_salt_to_sipkey(parser, &sip_key); + sip24_init(&sip_state, &sip_key); + + ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); - if (!id || !id->prefix) - return XML_ERROR_NO_MEMORY; + if (! id || ! id->prefix) { + /* This code is walking through the appAtts array, dealing + * with (in this case) a prefixed attribute name. To be in + * the array, the attribute must have already been bound, so + * has to have passed through the hash table lookup once + * already. That implies that an entry for it already + * exists, so the lookup above will return a pointer to + * already allocated memory. There is no opportunaity for + * the allocator to fail, so the condition above cannot be + * fulfilled. + * + * Since it is difficult to be certain that the above + * analysis is complete, we retain the test and merely + * remove the code from coverage tests. + */ + return XML_ERROR_NO_MEMORY; /* LCOV_EXCL_LINE */ + } b = id->prefix->binding; - if (!b) + if (! b) return XML_ERROR_UNBOUND_PREFIX; - /* as we expand the name we also calculate its hash value */ for (j = 0; j < b->uriLen; j++) { const XML_Char c = b->uri[j]; - if (!poolAppendChar(&tempPool, c)) + if (! poolAppendChar(&parser->m_tempPool, c)) return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); } + + sip24_update(&sip_state, b->uri, b->uriLen * sizeof(XML_Char)); + while (*s++ != XML_T(ASCII_COLON)) ; - do { /* copies null terminator */ - const XML_Char c = *s; - if (!poolAppendChar(&tempPool, *s)) + + sip24_update(&sip_state, s, keylen(s) * sizeof(XML_Char)); + + do { /* copies null terminator */ + if (! poolAppendChar(&parser->m_tempPool, *s)) return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); } while (*s++); + uriHash = (unsigned long)sip24_final(&sip_state); + { /* Check hash table for duplicate of expanded name (uriName). Derived from code in lookup(parser, HASH_TABLE *table, ...). */ unsigned char step = 0; unsigned long mask = nsAttsSize - 1; - j = uriHash & mask; /* index into hash table */ - while (nsAtts[j].version == version) { + j = uriHash & mask; /* index into hash table */ + while (parser->m_nsAtts[j].version == version) { /* for speed we compare stored hash values first */ - if (uriHash == nsAtts[j].hash) { - const XML_Char *s1 = poolStart(&tempPool); - const XML_Char *s2 = nsAtts[j].uriName; + if (uriHash == parser->m_nsAtts[j].hash) { + const XML_Char *s1 = poolStart(&parser->m_tempPool); + const XML_Char *s2 = parser->m_nsAtts[j].uriName; /* s1 is null terminated, but not s2 */ - for (; *s1 == *s2 && *s1 != 0; s1++, s2++); + for (; *s1 == *s2 && *s1 != 0; s1++, s2++) + ; if (*s1 == 0) return XML_ERROR_DUPLICATE_ATTRIBUTE; } - if (!step) - step = PROBE_STEP(uriHash, mask, nsAttsPower); + if (! step) + step = PROBE_STEP(uriHash, mask, parser->m_nsAttsPower); j < step ? (j += nsAttsSize - step) : (j -= step); } } - if (ns_triplets) { /* append namespace separator and prefix */ - tempPool.ptr[-1] = namespaceSeparator; + if (parser->m_ns_triplets) { /* append namespace separator and prefix */ + parser->m_tempPool.ptr[-1] = parser->m_namespaceSeparator; s = b->prefix->name; do { - if (!poolAppendChar(&tempPool, *s)) + if (! poolAppendChar(&parser->m_tempPool, *s)) return XML_ERROR_NO_MEMORY; } while (*s++); } /* store expanded name in attribute list */ - s = poolStart(&tempPool); - poolFinish(&tempPool); + s = poolStart(&parser->m_tempPool); + poolFinish(&parser->m_tempPool); appAtts[i] = s; /* fill empty slot with new version, uriName and hash value */ - nsAtts[j].version = version; - nsAtts[j].hash = uriHash; - nsAtts[j].uriName = s; + parser->m_nsAtts[j].version = version; + parser->m_nsAtts[j].hash = uriHash; + parser->m_nsAtts[j].uriName = s; - if (!--nPrefixes) { + if (! --nPrefixes) { i += 2; break; } - } - else /* not prefixed */ - ((XML_Char *)s)[-1] = 0; /* clear flag */ + } else /* not prefixed */ + ((XML_Char *)s)[-1] = 0; /* clear flag */ } } /* clear flags for the remaining attributes */ @@ -3030,88 +3635,219 @@ storeAtts(XML_Parser parser, const ENCODING *enc, for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) binding->attId->name[-1] = 0; - if (!ns) + if (! parser->m_ns) return XML_ERROR_NONE; /* expand the element type name */ if (elementType->prefix) { binding = elementType->prefix->binding; - if (!binding) + if (! binding) return XML_ERROR_UNBOUND_PREFIX; localPart = tagNamePtr->str; while (*localPart++ != XML_T(ASCII_COLON)) ; - } - else if (dtd->defaultPrefix.binding) { + } else if (dtd->defaultPrefix.binding) { binding = dtd->defaultPrefix.binding; localPart = tagNamePtr->str; - } - else + } else return XML_ERROR_NONE; prefixLen = 0; - if (ns_triplets && binding->prefix->name) { + if (parser->m_ns_triplets && binding->prefix->name) { for (; binding->prefix->name[prefixLen++];) - ; /* prefixLen includes null terminator */ + ; /* prefixLen includes null terminator */ } tagNamePtr->localPart = localPart; tagNamePtr->uriLen = binding->uriLen; tagNamePtr->prefix = binding->prefix->name; tagNamePtr->prefixLen = prefixLen; for (i = 0; localPart[i++];) - ; /* i includes null terminator */ + ; /* i includes null terminator */ + + /* Detect and prevent integer overflow */ + if (binding->uriLen > INT_MAX - prefixLen + || i > INT_MAX - (binding->uriLen + prefixLen)) { + return XML_ERROR_NO_MEMORY; + } + n = i + binding->uriLen + prefixLen; if (n > binding->uriAlloc) { TAG *p; - uri = (XML_Char *)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char)); - if (!uri) + + /* Detect and prevent integer overflow */ + if (n > INT_MAX - EXPAND_SPARE) { + return XML_ERROR_NO_MEMORY; + } + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if ((unsigned)(n + EXPAND_SPARE) > (size_t)(-1) / sizeof(XML_Char)) { + return XML_ERROR_NO_MEMORY; + } +#endif + + uri = (XML_Char *)MALLOC(parser, (n + EXPAND_SPARE) * sizeof(XML_Char)); + if (! uri) return XML_ERROR_NO_MEMORY; binding->uriAlloc = n + EXPAND_SPARE; memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char)); - for (p = tagStack; p; p = p->parent) + for (p = parser->m_tagStack; p; p = p->parent) if (p->name.str == binding->uri) p->name.str = uri; - FREE(binding->uri); + FREE(parser, binding->uri); binding->uri = uri; } - /* if namespaceSeparator != '\0' then uri includes it already */ + /* if m_namespaceSeparator != '\0' then uri includes it already */ uri = binding->uri + binding->uriLen; memcpy(uri, localPart, i * sizeof(XML_Char)); /* we always have a namespace separator between localPart and prefix */ if (prefixLen) { uri += i - 1; - *uri = namespaceSeparator; /* replace null terminator */ + *uri = parser->m_namespaceSeparator; /* replace null terminator */ memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char)); } tagNamePtr->str = binding->uri; return XML_ERROR_NONE; } +static XML_Bool +is_rfc3986_uri_char(XML_Char candidate) { + // For the RFC 3986 ANBF grammar see + // https://datatracker.ietf.org/doc/html/rfc3986#appendix-A + + switch (candidate) { + // From rule "ALPHA" (uppercase half) + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + + // From rule "ALPHA" (lowercase half) + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + + // From rule "DIGIT" + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + + // From rule "pct-encoded" + case '%': + + // From rule "unreserved" + case '-': + case '.': + case '_': + case '~': + + // From rule "gen-delims" + case ':': + case '/': + case '?': + case '#': + case '[': + case ']': + case '@': + + // From rule "sub-delims" + case '!': + case '$': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case ';': + case '=': + return XML_TRUE; + + default: + return XML_FALSE; + } +} + /* addBinding() overwrites the value of prefix->binding without checking. Therefore one must keep track of the old value outside of addBinding(). */ static enum XML_Error addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr) -{ - static const XML_Char xmlNamespace[] = { - ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, - ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, - ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, - ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH, - ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c, - ASCII_e, '\0' - }; - static const int xmlLen = - (int)sizeof(xmlNamespace)/sizeof(XML_Char) - 1; - static const XML_Char xmlnsNamespace[] = { - ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, - ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, - ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0, - ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s, - ASCII_SLASH, '\0' - }; - static const int xmlnsLen = - (int)sizeof(xmlnsNamespace)/sizeof(XML_Char) - 1; + const XML_Char *uri, BINDING **bindingsPtr) { + // "http://www.w3.org/XML/1998/namespace" + static const XML_Char xmlNamespace[] + = {ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, + ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, + ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, + ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, + ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, + ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, + ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c, + ASCII_e, '\0'}; + static const int xmlLen = (int)sizeof(xmlNamespace) / sizeof(XML_Char) - 1; + // "http://www.w3.org/2000/xmlns/" + static const XML_Char xmlnsNamespace[] + = {ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, + ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, + ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, + ASCII_2, ASCII_0, ASCII_0, ASCII_0, ASCII_SLASH, ASCII_x, + ASCII_m, ASCII_l, ASCII_n, ASCII_s, ASCII_SLASH, '\0'}; + static const int xmlnsLen + = (int)sizeof(xmlnsNamespace) / sizeof(XML_Char) - 1; XML_Bool mustBeXML = XML_FALSE; XML_Bool isXML = XML_TRUE; @@ -3124,14 +3860,11 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, if (*uri == XML_T('\0') && prefix->name) return XML_ERROR_UNDECLARING_PREFIX; - if (prefix->name - && prefix->name[0] == XML_T(ASCII_x) + if (prefix->name && prefix->name[0] == XML_T(ASCII_x) && prefix->name[1] == XML_T(ASCII_m) && prefix->name[2] == XML_T(ASCII_l)) { - /* Not allowed to bind xmlns */ - if (prefix->name[3] == XML_T(ASCII_n) - && prefix->name[4] == XML_T(ASCII_s) + if (prefix->name[3] == XML_T(ASCII_n) && prefix->name[4] == XML_T(ASCII_s) && prefix->name[5] == XML_T('\0')) return XML_ERROR_RESERVED_PREFIX_XMLNS; @@ -3143,9 +3876,32 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len])) isXML = XML_FALSE; - if (!mustBeXML && isXMLNS + if (! mustBeXML && isXMLNS && (len > xmlnsLen || uri[len] != xmlnsNamespace[len])) isXMLNS = XML_FALSE; + + // NOTE: While Expat does not validate namespace URIs against RFC 3986 + // today (and is not REQUIRED to do so with regard to the XML 1.0 + // namespaces specification) we have to at least make sure, that + // the application on top of Expat (that is likely splitting expanded + // element names ("qualified names") of form + // "[uri sep] local [sep prefix] '\0'" back into 1, 2 or 3 pieces + // in its element handler code) cannot be confused by an attacker + // putting additional namespace separator characters into namespace + // declarations. That would be ambiguous and not to be expected. + // + // While the HTML API docs of function XML_ParserCreateNS have been + // advising against use of a namespace separator character that can + // appear in a URI for >20 years now, some widespread applications + // are using URI characters (':' (colon) in particular) for a + // namespace separator, in practice. To keep these applications + // functional, we only reject namespaces URIs containing the + // application-chosen namespace separator if the chosen separator + // is a non-URI character with regard to RFC 3986. + if (parser->m_ns && (uri[len] == parser->m_namespaceSeparator) + && ! is_rfc3986_uri_char(uri[len])) { + return XML_ERROR_SYNTAX; + } } isXML = isXML && len == xmlLen; isXMLNS = isXMLNS && len == xmlnsLen; @@ -3157,49 +3913,79 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, if (isXMLNS) return XML_ERROR_RESERVED_NAMESPACE_URI; - if (namespaceSeparator) + if (parser->m_namespaceSeparator) len++; - if (freeBindingList) { - b = freeBindingList; + if (parser->m_freeBindingList) { + b = parser->m_freeBindingList; if (len > b->uriAlloc) { - XML_Char *temp = (XML_Char *)REALLOC(b->uri, - sizeof(XML_Char) * (len + EXPAND_SPARE)); + /* Detect and prevent integer overflow */ + if (len > INT_MAX - EXPAND_SPARE) { + return XML_ERROR_NO_MEMORY; + } + + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if ((unsigned)(len + EXPAND_SPARE) > (size_t)(-1) / sizeof(XML_Char)) { + return XML_ERROR_NO_MEMORY; + } +#endif + + XML_Char *temp = (XML_Char *)REALLOC( + parser, b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE)); if (temp == NULL) return XML_ERROR_NO_MEMORY; b->uri = temp; b->uriAlloc = len + EXPAND_SPARE; } - freeBindingList = b->nextTagBinding; - } - else { - b = (BINDING *)MALLOC(sizeof(BINDING)); - if (!b) + parser->m_freeBindingList = b->nextTagBinding; + } else { + b = (BINDING *)MALLOC(parser, sizeof(BINDING)); + if (! b) return XML_ERROR_NO_MEMORY; - b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (!b->uri) { - FREE(b); + + /* Detect and prevent integer overflow */ + if (len > INT_MAX - EXPAND_SPARE) { + return XML_ERROR_NO_MEMORY; + } + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if ((unsigned)(len + EXPAND_SPARE) > (size_t)(-1) / sizeof(XML_Char)) { + return XML_ERROR_NO_MEMORY; + } +#endif + + b->uri + = (XML_Char *)MALLOC(parser, sizeof(XML_Char) * (len + EXPAND_SPARE)); + if (! b->uri) { + FREE(parser, b); return XML_ERROR_NO_MEMORY; } b->uriAlloc = len + EXPAND_SPARE; } b->uriLen = len; memcpy(b->uri, uri, len * sizeof(XML_Char)); - if (namespaceSeparator) - b->uri[len - 1] = namespaceSeparator; + if (parser->m_namespaceSeparator) + b->uri[len - 1] = parser->m_namespaceSeparator; b->prefix = prefix; b->attId = attId; b->prevPrefixBinding = prefix->binding; /* NULL binding when default namespace undeclared */ - if (*uri == XML_T('\0') && prefix == &_dtd->defaultPrefix) + if (*uri == XML_T('\0') && prefix == &parser->m_dtd->defaultPrefix) prefix->binding = NULL; else prefix->binding = b; b->nextTagBinding = *bindingsPtr; *bindingsPtr = b; /* if attId == NULL then we are not starting a namespace scope */ - if (attId && startNamespaceDeclHandler) - startNamespaceDeclHandler(handlerArg, prefix->name, - prefix->binding ? uri : 0); + if (attId && parser->m_startNamespaceDeclHandler) + parser->m_startNamespaceDeclHandler(parser->m_handlerArg, prefix->name, + prefix->binding ? uri : 0); return XML_ERROR_NONE; } @@ -3207,22 +3993,19 @@ addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, the whole file is parsed with one call. */ static enum XML_Error PTRCALL -cdataSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doCdataSection(parser, encoding, &start, end, - endPtr, (XML_Bool)!ps_finalBuffer); +cdataSectionProcessor(XML_Parser parser, const char *start, const char *end, + const char **endPtr) { + enum XML_Error result = doCdataSection( + parser, parser->m_encoding, &start, end, endPtr, + (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_ACCOUNT_DIRECT); if (result != XML_ERROR_NONE) return result; if (start) { - if (parentParser) { /* we are parsing an external entity */ - processor = externalEntityContentProcessor; + if (parser->m_parentParser) { /* we are parsing an external entity */ + parser->m_processor = externalEntityContentProcessor; return externalEntityContentProcessor(parser, start, end, endPtr); - } - else { - processor = contentProcessor; + } else { + parser->m_processor = contentProcessor; return contentProcessor(parser, start, end, endPtr); } } @@ -3233,82 +4016,82 @@ cdataSectionProcessor(XML_Parser parser, the section is not yet closed. */ static enum XML_Error -doCdataSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ +doCdataSection(XML_Parser parser, const ENCODING *enc, const char **startPtr, + const char *end, const char **nextPtr, XML_Bool haveMore, + enum XML_Account account) { const char *s = *startPtr; const char **eventPP; const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; + if (enc == parser->m_encoding) { + eventPP = &parser->m_eventPtr; *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); + eventEndPP = &parser->m_eventEndPtr; + } else { + eventPP = &(parser->m_openInternalEntities->internalEventPtr); + eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr); } *eventPP = s; *startPtr = NULL; for (;;) { - const char *next; + const char *next = s; /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */ int tok = XmlCdataSectionTok(enc, s, end, &next); +#ifdef XML_DTD + if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, account)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } +#else + UNUSED_P(account); +#endif *eventEndPP = next; switch (tok) { case XML_TOK_CDATA_SECT_CLOSE: - if (endCdataSectionHandler) - endCdataSectionHandler(handlerArg); -#if 0 + if (parser->m_endCdataSectionHandler) + parser->m_endCdataSectionHandler(parser->m_handlerArg); + /* BEGIN disabled code */ /* see comment under XML_TOK_CDATA_SECT_OPEN */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) + else if (0 && parser->m_characterDataHandler) + parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, + 0); + /* END disabled code */ + else if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; *nextPtr = next; - if (ps_parsing == XML_FINISHED) + if (parser->m_parsingStatus.parsing == XML_FINISHED) return XML_ERROR_ABORTED; else return XML_ERROR_NONE; case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { + if (parser->m_characterDataHandler) { XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) + parser->m_characterDataHandler(parser->m_handlerArg, &c, 1); + } else if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); break; - case XML_TOK_DATA_CHARS: - { - XML_CharacterDataHandler charDataHandler = characterDataHandler; - if (charDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - const enum XML_Convert_Result convert_res = XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = next; - charDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) - break; - *eventPP = s; - } + case XML_TOK_DATA_CHARS: { + XML_CharacterDataHandler charDataHandler = parser->m_characterDataHandler; + if (charDataHandler) { + if (MUST_CONVERT(enc, s)) { + for (;;) { + ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf; + const enum XML_Convert_Result convert_res = XmlConvert( + enc, &s, next, &dataPtr, (ICHAR *)parser->m_dataBufEnd); + *eventEndPP = next; + charDataHandler(parser->m_handlerArg, parser->m_dataBuf, + (int)(dataPtr - (ICHAR *)parser->m_dataBuf)); + if ((convert_res == XML_CONVERT_COMPLETED) + || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) + break; + *eventPP = s; } - else - charDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; + } else + charDataHandler(parser->m_handlerArg, (XML_Char *)s, + (int)((XML_Char *)next - (XML_Char *)s)); + } else if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + } break; case XML_TOK_INVALID: *eventPP = next; return XML_ERROR_INVALID_TOKEN; @@ -3326,18 +4109,26 @@ doCdataSection(XML_Parser parser, } return XML_ERROR_UNCLOSED_CDATA_SECTION; default: + /* Every token returned by XmlCdataSectionTok() has its own + * explicit case, so this default case will never be executed. + * We retain it as a safety net and exclude it from the coverage + * statistics. + * + * LCOV_EXCL_START + */ *eventPP = next; return XML_ERROR_UNEXPECTED_STATE; + /* LCOV_EXCL_STOP */ } *eventPP = s = next; - switch (ps_parsing) { + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; - default: ; + default:; } } /* not reached */ @@ -3349,17 +4140,15 @@ doCdataSection(XML_Parser parser, the whole file is parsed with one call. */ static enum XML_Error PTRCALL -ignoreSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, - endPtr, (XML_Bool)!ps_finalBuffer); +ignoreSectionProcessor(XML_Parser parser, const char *start, const char *end, + const char **endPtr) { + enum XML_Error result + = doIgnoreSection(parser, parser->m_encoding, &start, end, endPtr, + (XML_Bool)! parser->m_parsingStatus.finalBuffer); if (result != XML_ERROR_NONE) return result; if (start) { - processor = prologProcessor; + parser->m_processor = prologProcessor; return prologProcessor(parser, start, end, endPtr); } return result; @@ -3369,38 +4158,51 @@ ignoreSectionProcessor(XML_Parser parser, if the section is not yet closed. */ static enum XML_Error -doIgnoreSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - const char *next; +doIgnoreSection(XML_Parser parser, const ENCODING *enc, const char **startPtr, + const char *end, const char **nextPtr, XML_Bool haveMore) { + const char *next = *startPtr; /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */ int tok; const char *s = *startPtr; const char **eventPP; const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; + if (enc == parser->m_encoding) { + eventPP = &parser->m_eventPtr; *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); + eventEndPP = &parser->m_eventEndPtr; + } else { + /* It's not entirely clear, but it seems the following two lines + * of code cannot be executed. The only occasions on which 'enc' + * is not 'encoding' are when this function is called + * from the internal entity processing, and IGNORE sections are an + * error in internal entities. + * + * Since it really isn't clear that this is true, we keep the code + * and just remove it from our coverage tests. + * + * LCOV_EXCL_START + */ + eventPP = &(parser->m_openInternalEntities->internalEventPtr); + eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr); + /* LCOV_EXCL_STOP */ } *eventPP = s; *startPtr = NULL; tok = XmlIgnoreSectionTok(enc, s, end, &next); +# ifdef XML_DTD + if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, + XML_ACCOUNT_DIRECT)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } +# endif *eventEndPP = next; switch (tok) { case XML_TOK_IGNORE_SECT: - if (defaultHandler) + if (parser->m_defaultHandler) reportDefault(parser, enc, s, next); *startPtr = next; *nextPtr = next; - if (ps_parsing == XML_FINISHED) + if (parser->m_parsingStatus.parsing == XML_FINISHED) return XML_ERROR_ABORTED; else return XML_ERROR_NONE; @@ -3421,8 +4223,16 @@ doIgnoreSection(XML_Parser parser, } return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ default: + /* All of the tokens that XmlIgnoreSectionTok() returns have + * explicit cases to handle them, so this default case is never + * executed. We keep it as a safety net anyway, and remove it + * from our test coverage statistics. + * + * LCOV_EXCL_START + */ *eventPP = next; return XML_ERROR_UNEXPECTED_STATE; + /* LCOV_EXCL_STOP */ } /* not reached */ } @@ -3430,127 +4240,130 @@ doIgnoreSection(XML_Parser parser, #endif /* XML_DTD */ static enum XML_Error -initializeEncoding(XML_Parser parser) -{ +initializeEncoding(XML_Parser parser) { const char *s; #ifdef XML_UNICODE char encodingBuf[128]; - if (!protocolEncodingName) + /* See comments about `protocolEncodingName` in parserInit() */ + if (! parser->m_protocolEncodingName) s = NULL; else { int i; - for (i = 0; protocolEncodingName[i]; i++) { + for (i = 0; parser->m_protocolEncodingName[i]; i++) { if (i == sizeof(encodingBuf) - 1 - || (protocolEncodingName[i] & ~0x7f) != 0) { + || (parser->m_protocolEncodingName[i] & ~0x7f) != 0) { encodingBuf[0] = '\0'; break; } - encodingBuf[i] = (char)protocolEncodingName[i]; + encodingBuf[i] = (char)parser->m_protocolEncodingName[i]; } encodingBuf[i] = '\0'; s = encodingBuf; } #else - s = protocolEncodingName; + s = parser->m_protocolEncodingName; #endif - if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) + if ((parser->m_ns ? XmlInitEncodingNS : XmlInitEncoding)( + &parser->m_initEncoding, &parser->m_encoding, s)) return XML_ERROR_NONE; - return handleUnknownEncoding(parser, protocolEncodingName); + return handleUnknownEncoding(parser, parser->m_protocolEncodingName); } static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next) -{ +processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *s, + const char *next) { const char *encodingName = NULL; const XML_Char *storedEncName = NULL; const ENCODING *newEncoding = NULL; const char *version = NULL; - const char *versionend; + const char *versionend = NULL; const XML_Char *storedversion = NULL; int standalone = -1; - if (!(ns - ? XmlParseXmlDeclNS - : XmlParseXmlDecl)(isGeneralTextEntity, - encoding, - s, - next, - &eventPtr, - &version, - &versionend, - &encodingName, - &newEncoding, - &standalone)) { + +#ifdef XML_DTD + if (! accountingDiffTolerated(parser, XML_TOK_XML_DECL, s, next, __LINE__, + XML_ACCOUNT_DIRECT)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } +#endif + + if (! (parser->m_ns ? XmlParseXmlDeclNS : XmlParseXmlDecl)( + isGeneralTextEntity, parser->m_encoding, s, next, &parser->m_eventPtr, + &version, &versionend, &encodingName, &newEncoding, &standalone)) { if (isGeneralTextEntity) return XML_ERROR_TEXT_DECL; else return XML_ERROR_XML_DECL; } - if (!isGeneralTextEntity && standalone == 1) { - _dtd->standalone = XML_TRUE; + if (! isGeneralTextEntity && standalone == 1) { + parser->m_dtd->standalone = XML_TRUE; #ifdef XML_DTD - if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; + if (parser->m_paramEntityParsing + == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) + parser->m_paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; #endif /* XML_DTD */ } - if (xmlDeclHandler) { + if (parser->m_xmlDeclHandler) { if (encodingName != NULL) { - storedEncName = poolStoreString(&temp2Pool, - encoding, - encodingName, - encodingName - + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - poolFinish(&temp2Pool); + storedEncName = poolStoreString( + &parser->m_temp2Pool, parser->m_encoding, encodingName, + encodingName + XmlNameLength(parser->m_encoding, encodingName)); + if (! storedEncName) + return XML_ERROR_NO_MEMORY; + poolFinish(&parser->m_temp2Pool); } if (version) { - storedversion = poolStoreString(&temp2Pool, - encoding, - version, - versionend - encoding->minBytesPerChar); - if (!storedversion) + storedversion + = poolStoreString(&parser->m_temp2Pool, parser->m_encoding, version, + versionend - parser->m_encoding->minBytesPerChar); + if (! storedversion) return XML_ERROR_NO_MEMORY; } - xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone); - } - else if (defaultHandler) - reportDefault(parser, encoding, s, next); - if (protocolEncodingName == NULL) { + parser->m_xmlDeclHandler(parser->m_handlerArg, storedversion, storedEncName, + standalone); + } else if (parser->m_defaultHandler) + reportDefault(parser, parser->m_encoding, s, next); + if (parser->m_protocolEncodingName == NULL) { if (newEncoding) { - if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { - eventPtr = encodingName; + /* Check that the specified encoding does not conflict with what + * the parser has already deduced. Do we have the same number + * of bytes in the smallest representation of a character? If + * this is UTF-16, is it the same endianness? + */ + if (newEncoding->minBytesPerChar != parser->m_encoding->minBytesPerChar + || (newEncoding->minBytesPerChar == 2 + && newEncoding != parser->m_encoding)) { + parser->m_eventPtr = encodingName; return XML_ERROR_INCORRECT_ENCODING; } - encoding = newEncoding; - } - else if (encodingName) { + parser->m_encoding = newEncoding; + } else if (encodingName) { enum XML_Error result; - if (!storedEncName) { + if (! storedEncName) { storedEncName = poolStoreString( - &temp2Pool, encoding, encodingName, - encodingName + XmlNameLength(encoding, encodingName)); - if (!storedEncName) + &parser->m_temp2Pool, parser->m_encoding, encodingName, + encodingName + XmlNameLength(parser->m_encoding, encodingName)); + if (! storedEncName) return XML_ERROR_NO_MEMORY; } result = handleUnknownEncoding(parser, storedEncName); - poolClear(&temp2Pool); + poolClear(&parser->m_temp2Pool); if (result == XML_ERROR_UNKNOWN_ENCODING) - eventPtr = encodingName; + parser->m_eventPtr = encodingName; return result; } } if (storedEncName || storedversion) - poolClear(&temp2Pool); + poolClear(&parser->m_temp2Pool); return XML_ERROR_NONE; } static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - if (unknownEncodingHandler) { +handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) { + if (parser->m_unknownEncodingHandler) { XML_Encoding info; int i; for (i = 0; i < 256; i++) @@ -3558,25 +4371,21 @@ handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) info.convert = NULL; info.data = NULL; info.release = NULL; - if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, - &info)) { + if (parser->m_unknownEncodingHandler(parser->m_unknownEncodingHandlerData, + encodingName, &info)) { ENCODING *enc; - unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding()); - if (!unknownEncodingMem) { + parser->m_unknownEncodingMem = MALLOC(parser, XmlSizeOfUnknownEncoding()); + if (! parser->m_unknownEncodingMem) { if (info.release) info.release(info.data); return XML_ERROR_NO_MEMORY; } - enc = (ns - ? XmlInitUnknownEncodingNS - : XmlInitUnknownEncoding)(unknownEncodingMem, - info.map, - info.convert, - info.data); + enc = (parser->m_ns ? XmlInitUnknownEncodingNS : XmlInitUnknownEncoding)( + parser->m_unknownEncodingMem, info.map, info.convert, info.data); if (enc) { - unknownEncodingData = info.data; - unknownEncodingRelease = info.release; - encoding = enc; + parser->m_unknownEncodingData = info.data; + parser->m_unknownEncodingRelease = info.release; + parser->m_encoding = enc; return XML_ERROR_NONE; } } @@ -3587,60 +4396,54 @@ handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) } static enum XML_Error PTRCALL -prologInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ +prologInitProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; - processor = prologProcessor; + parser->m_processor = prologProcessor; return prologProcessor(parser, s, end, nextPtr); } #ifdef XML_DTD static enum XML_Error PTRCALL -externalParEntInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ +externalParEntInitProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { enum XML_Error result = initializeEncoding(parser); if (result != XML_ERROR_NONE) return result; /* we know now that XML_Parse(Buffer) has been called, so we consider the external parameter entity read */ - _dtd->paramEntityRead = XML_TRUE; + parser->m_dtd->paramEntityRead = XML_TRUE; - if (prologState.inEntityValue) { - processor = entityValueInitProcessor; + if (parser->m_prologState.inEntityValue) { + parser->m_processor = entityValueInitProcessor; return entityValueInitProcessor(parser, s, end, nextPtr); - } - else { - processor = externalParEntProcessor; + } else { + parser->m_processor = externalParEntProcessor; return externalParEntProcessor(parser, s, end, nextPtr); } } static enum XML_Error PTRCALL -entityValueInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ +entityValueInitProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { int tok; const char *start = s; const char *next = start; - eventPtr = start; + parser->m_eventPtr = start; for (;;) { - tok = XmlPrologTok(encoding, start, end, &next); - eventEndPtr = next; + tok = XmlPrologTok(parser->m_encoding, start, end, &next); + /* Note: Except for XML_TOK_BOM below, these bytes are accounted later in: + - storeEntityValue + - processXmlDecl + */ + parser->m_eventEndPtr = next; if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { + if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) { *nextPtr = s; return XML_ERROR_NONE; } @@ -3651,29 +4454,28 @@ entityValueInitProcessor(XML_Parser parser, return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ + case XML_TOK_NONE: /* start == end */ default: break; } /* found end of entity value - can store it now */ - return storeEntityValue(parser, encoding, s, end); - } - else if (tok == XML_TOK_XML_DECL) { + return storeEntityValue(parser, parser->m_encoding, s, end, + XML_ACCOUNT_DIRECT); + } else if (tok == XML_TOK_XML_DECL) { enum XML_Error result; result = processXmlDecl(parser, 0, start, next); if (result != XML_ERROR_NONE) return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: + /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For + * that to happen, a parameter entity parsing handler must have attempted + * to suspend the parser, which fails and raises an error. The parser can + * be aborted, but can't be suspended. + */ + if (parser->m_parsingStatus.parsing == XML_FINISHED) return XML_ERROR_ABORTED; - default: - *nextPtr = next; - } + *nextPtr = next; /* stop scanning for text declaration - we found one */ - processor = entityValueProcessor; + parser->m_processor = entityValueProcessor; return entityValueProcessor(parser, next, end, nextPtr); } /* If we are at the end of the buffer, this would cause XmlPrologTok to @@ -3683,27 +4485,41 @@ entityValueInitProcessor(XML_Parser parser, then, when this routine is entered the next time, XmlPrologTok will return XML_TOK_INVALID, since the BOM is still in the buffer */ - else if (tok == XML_TOK_BOM && next == end && !ps_finalBuffer) { + else if (tok == XML_TOK_BOM && next == end + && ! parser->m_parsingStatus.finalBuffer) { +# ifdef XML_DTD + if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, + XML_ACCOUNT_DIRECT)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } +# endif + *nextPtr = next; return XML_ERROR_NONE; } + /* If we get this token, we have the start of what might be a + normal tag, but not a declaration (i.e. it doesn't begin with + "m_eventPtr = start; } } static enum XML_Error PTRCALL -externalParEntProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ +externalParEntProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { const char *next = s; int tok; - tok = XmlPrologTok(encoding, s, end, &next); + tok = XmlPrologTok(parser->m_encoding, s, end, &next); if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { + if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) { *nextPtr = s; return XML_ERROR_NONE; } @@ -3714,40 +4530,48 @@ externalParEntProcessor(XML_Parser parser, return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ + case XML_TOK_NONE: /* start == end */ default: break; } } /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM. However, when parsing an external subset, doProlog will not accept a BOM - as valid, and report a syntax error, so we have to skip the BOM + as valid, and report a syntax error, so we have to skip the BOM, and + account for the BOM bytes. */ else if (tok == XML_TOK_BOM) { + if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, + XML_ACCOUNT_DIRECT)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } + s = next; - tok = XmlPrologTok(encoding, s, end, &next); + tok = XmlPrologTok(parser->m_encoding, s, end, &next); } - processor = prologProcessor; - return doProlog(parser, encoding, s, end, tok, next, - nextPtr, (XML_Bool)!ps_finalBuffer); + parser->m_processor = prologProcessor; + return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr, + (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE, + XML_ACCOUNT_DIRECT); } static enum XML_Error PTRCALL -entityValueProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ +entityValueProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { const char *start = s; const char *next = s; - const ENCODING *enc = encoding; + const ENCODING *enc = parser->m_encoding; int tok; for (;;) { tok = XmlPrologTok(enc, start, end, &next); + /* Note: These bytes are accounted later in: + - storeEntityValue + */ if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { + if (! parser->m_parsingStatus.finalBuffer && tok != XML_TOK_INVALID) { *nextPtr = s; return XML_ERROR_NONE; } @@ -3758,12 +4582,12 @@ entityValueProcessor(XML_Parser parser, return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ + case XML_TOK_NONE: /* start == end */ default: break; } /* found end of entity value - can store it now */ - return storeEntityValue(parser, enc, s, end); + return storeEntityValue(parser, enc, s, end, XML_ACCOUNT_DIRECT); } start = next; } @@ -3772,64 +4596,62 @@ entityValueProcessor(XML_Parser parser, #endif /* XML_DTD */ static enum XML_Error PTRCALL -prologProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ +prologProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { const char *next = s; - int tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, - nextPtr, (XML_Bool)!ps_finalBuffer); + int tok = XmlPrologTok(parser->m_encoding, s, end, &next); + return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr, + (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE, + XML_ACCOUNT_DIRECT); } static enum XML_Error -doProlog(XML_Parser parser, - const ENCODING *enc, - const char *s, - const char *end, - int tok, - const char *next, - const char **nextPtr, - XML_Bool haveMore) -{ +doProlog(XML_Parser parser, const ENCODING *enc, const char *s, const char *end, + int tok, const char *next, const char **nextPtr, XML_Bool haveMore, + XML_Bool allowClosingDoctype, enum XML_Account account) { #ifdef XML_DTD - static const XML_Char externalSubsetName[] = { ASCII_HASH , '\0' }; + static const XML_Char externalSubsetName[] = {ASCII_HASH, '\0'}; #endif /* XML_DTD */ - static const XML_Char atypeCDATA[] = - { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; - static const XML_Char atypeID[] = { ASCII_I, ASCII_D, '\0' }; - static const XML_Char atypeIDREF[] = - { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; - static const XML_Char atypeIDREFS[] = - { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; - static const XML_Char atypeENTITY[] = - { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; - static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N, - ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' }; - static const XML_Char atypeNMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; - static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, - ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' }; - static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T, - ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\0' }; - static const XML_Char enumValueSep[] = { ASCII_PIPE, '\0' }; - static const XML_Char enumValueStart[] = { ASCII_LPAREN, '\0' }; + static const XML_Char atypeCDATA[] + = {ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0'}; + static const XML_Char atypeID[] = {ASCII_I, ASCII_D, '\0'}; + static const XML_Char atypeIDREF[] + = {ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0'}; + static const XML_Char atypeIDREFS[] + = {ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0'}; + static const XML_Char atypeENTITY[] + = {ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0'}; + static const XML_Char atypeENTITIES[] + = {ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, + ASCII_I, ASCII_E, ASCII_S, '\0'}; + static const XML_Char atypeNMTOKEN[] + = {ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0'}; + static const XML_Char atypeNMTOKENS[] + = {ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, + ASCII_E, ASCII_N, ASCII_S, '\0'}; + static const XML_Char notationPrefix[] + = {ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, + ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\0'}; + static const XML_Char enumValueSep[] = {ASCII_PIPE, '\0'}; + static const XML_Char enumValueStart[] = {ASCII_LPAREN, '\0'}; + +#ifndef XML_DTD + UNUSED_P(account); +#endif /* save one level of indirection */ - DTD * const dtd = _dtd; + DTD *const dtd = parser->m_dtd; const char **eventPP; const char **eventEndPP; enum XML_Content_Quant quant; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); + if (enc == parser->m_encoding) { + eventPP = &parser->m_eventPtr; + eventEndPP = &parser->m_eventEndPtr; + } else { + eventPP = &(parser->m_openInternalEntities->internalEventPtr); + eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr); } for (;;) { @@ -3856,7 +4678,8 @@ doProlog(XML_Parser parser, case XML_TOK_NONE: #ifdef XML_DTD /* for internal PE NOT referenced between declarations */ - if (enc != encoding && !openInternalEntities->betweenDecl) { + if (enc != parser->m_encoding + && ! parser->m_openInternalEntities->betweenDecl) { *nextPtr = s; return XML_ERROR_NONE; } @@ -3864,8 +4687,8 @@ doProlog(XML_Parser parser, complete markup, not only for external PEs, but also for internal PEs if the reference occurs between declarations. */ - if (isParamEntity || enc != encoding) { - if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) + if (parser->m_isParamEntity || enc != parser->m_encoding) { + if (XmlTokenRole(&parser->m_prologState, XML_TOK_NONE, end, end, enc) == XML_ROLE_ERROR) return XML_ERROR_INCOMPLETE_PE; *nextPtr = s; @@ -3879,142 +4702,161 @@ doProlog(XML_Parser parser, break; } } - role = XmlTokenRole(&prologState, tok, s, next, enc); + role = XmlTokenRole(&parser->m_prologState, tok, s, next, enc); +#ifdef XML_DTD switch (role) { - case XML_ROLE_XML_DECL: - { - enum XML_Error result = processXmlDecl(parser, 0, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } + case XML_ROLE_INSTANCE_START: // bytes accounted in contentProcessor + case XML_ROLE_XML_DECL: // bytes accounted in processXmlDecl + case XML_ROLE_TEXT_DECL: // bytes accounted in processXmlDecl break; + default: + if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, account)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } + } +#endif + switch (role) { + case XML_ROLE_XML_DECL: { + enum XML_Error result = processXmlDecl(parser, 0, s, next); + if (result != XML_ERROR_NONE) + return result; + enc = parser->m_encoding; + handleDefault = XML_FALSE; + } break; case XML_ROLE_DOCTYPE_NAME: - if (startDoctypeDeclHandler) { - doctypeName = poolStoreString(&tempPool, enc, s, next); - if (!doctypeName) + if (parser->m_startDoctypeDeclHandler) { + parser->m_doctypeName + = poolStoreString(&parser->m_tempPool, enc, s, next); + if (! parser->m_doctypeName) return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - doctypePubid = NULL; + poolFinish(&parser->m_tempPool); + parser->m_doctypePubid = NULL; handleDefault = XML_FALSE; } - doctypeSysid = NULL; /* always initialize to NULL */ + parser->m_doctypeSysid = NULL; /* always initialize to NULL */ break; case XML_ROLE_DOCTYPE_INTERNAL_SUBSET: - if (startDoctypeDeclHandler) { - startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, - doctypePubid, 1); - doctypeName = NULL; - poolClear(&tempPool); + if (parser->m_startDoctypeDeclHandler) { + parser->m_startDoctypeDeclHandler( + parser->m_handlerArg, parser->m_doctypeName, parser->m_doctypeSysid, + parser->m_doctypePubid, 1); + parser->m_doctypeName = NULL; + poolClear(&parser->m_tempPool); handleDefault = XML_FALSE; } break; #ifdef XML_DTD - case XML_ROLE_TEXT_DECL: - { - enum XML_Error result = processXmlDecl(parser, 1, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; + case XML_ROLE_TEXT_DECL: { + enum XML_Error result = processXmlDecl(parser, 1, s, next); + if (result != XML_ERROR_NONE) + return result; + enc = parser->m_encoding; + handleDefault = XML_FALSE; + } break; #endif /* XML_DTD */ case XML_ROLE_DOCTYPE_PUBLIC_ID: #ifdef XML_DTD - useForeignDTD = XML_FALSE; - declEntity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) + parser->m_useForeignDTD = XML_FALSE; + parser->m_declEntity = (ENTITY *)lookup( + parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY)); + if (! parser->m_declEntity) return XML_ERROR_NO_MEMORY; #endif /* XML_DTD */ dtd->hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { + if (parser->m_startDoctypeDeclHandler) { XML_Char *pubId; - if (!XmlIsPublicId(enc, s, next, eventPP)) + if (! XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_PUBLICID; - pubId = poolStoreString(&tempPool, enc, + pubId = poolStoreString(&parser->m_tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); - if (!pubId) + if (! pubId) return XML_ERROR_NO_MEMORY; normalizePublicId(pubId); - poolFinish(&tempPool); - doctypePubid = pubId; + poolFinish(&parser->m_tempPool); + parser->m_doctypePubid = pubId; handleDefault = XML_FALSE; goto alreadyChecked; } /* fall through */ case XML_ROLE_ENTITY_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) + if (! XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_PUBLICID; alreadyChecked: - if (dtd->keepProcessing && declEntity) { - XML_Char *tem = poolStoreString(&dtd->pool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) + if (dtd->keepProcessing && parser->m_declEntity) { + XML_Char *tem + = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (! tem) return XML_ERROR_NO_MEMORY; normalizePublicId(tem); - declEntity->publicId = tem; + parser->m_declEntity->publicId = tem; poolFinish(&dtd->pool); - if (entityDeclHandler) + /* Don't suppress the default handler if we fell through from + * the XML_ROLE_DOCTYPE_PUBLIC_ID case. + */ + if (parser->m_entityDeclHandler && role == XML_ROLE_ENTITY_PUBLIC_ID) handleDefault = XML_FALSE; } break; case XML_ROLE_DOCTYPE_CLOSE: - if (doctypeName) { - startDoctypeDeclHandler(handlerArg, doctypeName, - doctypeSysid, doctypePubid, 0); - poolClear(&tempPool); + if (allowClosingDoctype != XML_TRUE) { + /* Must not close doctype from within expanded parameter entities */ + return XML_ERROR_INVALID_TOKEN; + } + + if (parser->m_doctypeName) { + parser->m_startDoctypeDeclHandler( + parser->m_handlerArg, parser->m_doctypeName, parser->m_doctypeSysid, + parser->m_doctypePubid, 0); + poolClear(&parser->m_tempPool); handleDefault = XML_FALSE; } - /* doctypeSysid will be non-NULL in the case of a previous - XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler + /* parser->m_doctypeSysid will be non-NULL in the case of a previous + XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler was not set, indicating an external subset */ #ifdef XML_DTD - if (doctypeSysid || useForeignDTD) { + if (parser->m_doctypeSysid || parser->m_useForeignDTD) { XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; dtd->hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - if (useForeignDTD) - entity->base = curBase; + if (parser->m_paramEntityParsing + && parser->m_externalEntityRefHandler) { + ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities, + externalSubsetName, sizeof(ENTITY)); + if (! entity) { + /* The external subset name "#" will have already been + * inserted into the hash table at the start of the + * external entity parsing, so no allocation will happen + * and lookup() cannot fail. + */ + return XML_ERROR_NO_MEMORY; /* LCOV_EXCL_LINE */ + } + if (parser->m_useForeignDTD) + entity->base = parser->m_curBase; dtd->paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) + if (! parser->m_externalEntityRefHandler( + parser->m_externalEntityRefHandlerArg, 0, entity->base, + entity->systemId, entity->publicId)) return XML_ERROR_EXTERNAL_ENTITY_HANDLING; if (dtd->paramEntityRead) { - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) + if (! dtd->standalone && parser->m_notStandaloneHandler + && ! parser->m_notStandaloneHandler(parser->m_handlerArg)) return XML_ERROR_NOT_STANDALONE; } /* if we didn't read the foreign DTD then this means that there is no external subset and we must reset dtd->hasParamEntityRefs */ - else if (!doctypeSysid) + else if (! parser->m_doctypeSysid) dtd->hasParamEntityRefs = hadParamEntityRefs; /* end of DTD - no need to update dtd->keepProcessing */ } - useForeignDTD = XML_FALSE; + parser->m_useForeignDTD = XML_FALSE; } #endif /* XML_DTD */ - if (endDoctypeDeclHandler) { - endDoctypeDeclHandler(handlerArg); + if (parser->m_endDoctypeDeclHandler) { + parser->m_endDoctypeDeclHandler(parser->m_handlerArg); handleDefault = XML_FALSE; } break; @@ -4023,27 +4865,24 @@ doProlog(XML_Parser parser, /* if there is no DOCTYPE declaration then now is the last chance to read the foreign DTD */ - if (useForeignDTD) { + if (parser->m_useForeignDTD) { XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; dtd->hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { + if (parser->m_paramEntityParsing + && parser->m_externalEntityRefHandler) { ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) + externalSubsetName, sizeof(ENTITY)); + if (! entity) return XML_ERROR_NO_MEMORY; - entity->base = curBase; + entity->base = parser->m_curBase; dtd->paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) + if (! parser->m_externalEntityRefHandler( + parser->m_externalEntityRefHandlerArg, 0, entity->base, + entity->systemId, entity->publicId)) return XML_ERROR_EXTERNAL_ENTITY_HANDLING; if (dtd->paramEntityRead) { - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) + if (! dtd->standalone && parser->m_notStandaloneHandler + && ! parser->m_notStandaloneHandler(parser->m_handlerArg)) return XML_ERROR_NOT_STANDALONE; } /* if we didn't read the foreign DTD then this means that there @@ -4055,156 +4894,154 @@ doProlog(XML_Parser parser, } } #endif /* XML_DTD */ - processor = contentProcessor; + parser->m_processor = contentProcessor; return contentProcessor(parser, s, end, nextPtr); case XML_ROLE_ATTLIST_ELEMENT_NAME: - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) + parser->m_declElementType = getElementType(parser, enc, s, next); + if (! parser->m_declElementType) return XML_ERROR_NO_MEMORY; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_NAME: - declAttributeId = getAttributeId(parser, enc, s, next); - if (!declAttributeId) + parser->m_declAttributeId = getAttributeId(parser, enc, s, next); + if (! parser->m_declAttributeId) return XML_ERROR_NO_MEMORY; - declAttributeIsCdata = XML_FALSE; - declAttributeType = NULL; - declAttributeIsId = XML_FALSE; + parser->m_declAttributeIsCdata = XML_FALSE; + parser->m_declAttributeType = NULL; + parser->m_declAttributeIsId = XML_FALSE; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_CDATA: - declAttributeIsCdata = XML_TRUE; - declAttributeType = atypeCDATA; + parser->m_declAttributeIsCdata = XML_TRUE; + parser->m_declAttributeType = atypeCDATA; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_ID: - declAttributeIsId = XML_TRUE; - declAttributeType = atypeID; + parser->m_declAttributeIsId = XML_TRUE; + parser->m_declAttributeType = atypeID; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_IDREF: - declAttributeType = atypeIDREF; + parser->m_declAttributeType = atypeIDREF; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_IDREFS: - declAttributeType = atypeIDREFS; + parser->m_declAttributeType = atypeIDREFS; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_ENTITY: - declAttributeType = atypeENTITY; + parser->m_declAttributeType = atypeENTITY; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES: - declAttributeType = atypeENTITIES; + parser->m_declAttributeType = atypeENTITIES; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN: - declAttributeType = atypeNMTOKEN; + parser->m_declAttributeType = atypeNMTOKEN; goto checkAttListDeclHandler; case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS: - declAttributeType = atypeNMTOKENS; + parser->m_declAttributeType = atypeNMTOKENS; checkAttListDeclHandler: - if (dtd->keepProcessing && attlistDeclHandler) + if (dtd->keepProcessing && parser->m_attlistDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_ATTRIBUTE_ENUM_VALUE: case XML_ROLE_ATTRIBUTE_NOTATION_VALUE: - if (dtd->keepProcessing && attlistDeclHandler) { + if (dtd->keepProcessing && parser->m_attlistDeclHandler) { const XML_Char *prefix; - if (declAttributeType) { + if (parser->m_declAttributeType) { prefix = enumValueSep; + } else { + prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE ? notationPrefix + : enumValueStart); } - else { - prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE - ? notationPrefix - : enumValueStart); - } - if (!poolAppendString(&tempPool, prefix)) + if (! poolAppendString(&parser->m_tempPool, prefix)) return XML_ERROR_NO_MEMORY; - if (!poolAppend(&tempPool, enc, s, next)) + if (! poolAppend(&parser->m_tempPool, enc, s, next)) return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; + parser->m_declAttributeType = parser->m_tempPool.start; handleDefault = XML_FALSE; } break; case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: if (dtd->keepProcessing) { - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, declAttributeIsId, - 0, parser)) + if (! defineAttribute(parser->m_declElementType, + parser->m_declAttributeId, + parser->m_declAttributeIsCdata, + parser->m_declAttributeIsId, 0, parser)) return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T(ASCII_LPAREN) - || (*declAttributeType == XML_T(ASCII_N) - && declAttributeType[1] == XML_T(ASCII_O))) { + if (parser->m_attlistDeclHandler && parser->m_declAttributeType) { + if (*parser->m_declAttributeType == XML_T(ASCII_LPAREN) + || (*parser->m_declAttributeType == XML_T(ASCII_N) + && parser->m_declAttributeType[1] == XML_T(ASCII_O))) { /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) - || !poolAppendChar(&tempPool, XML_T('\0'))) + if (! poolAppendChar(&parser->m_tempPool, XML_T(ASCII_RPAREN)) + || ! poolAppendChar(&parser->m_tempPool, XML_T('\0'))) return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); + parser->m_declAttributeType = parser->m_tempPool.start; + poolFinish(&parser->m_tempPool); } *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); - poolClear(&tempPool); + parser->m_attlistDeclHandler( + parser->m_handlerArg, parser->m_declElementType->name, + parser->m_declAttributeId->name, parser->m_declAttributeType, 0, + role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); handleDefault = XML_FALSE; } } + poolClear(&parser->m_tempPool); break; case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: case XML_ROLE_FIXED_ATTRIBUTE_VALUE: if (dtd->keepProcessing) { const XML_Char *attVal; - enum XML_Error result = - storeAttributeValue(parser, enc, declAttributeIsCdata, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar, - &dtd->pool); + enum XML_Error result = storeAttributeValue( + parser, enc, parser->m_declAttributeIsCdata, + s + enc->minBytesPerChar, next - enc->minBytesPerChar, &dtd->pool, + XML_ACCOUNT_NONE); if (result) return result; attVal = poolStart(&dtd->pool); poolFinish(&dtd->pool); /* ID attributes aren't allowed to have a default */ - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, XML_FALSE, attVal, parser)) + if (! defineAttribute( + parser->m_declElementType, parser->m_declAttributeId, + parser->m_declAttributeIsCdata, XML_FALSE, attVal, parser)) return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T(ASCII_LPAREN) - || (*declAttributeType == XML_T(ASCII_N) - && declAttributeType[1] == XML_T(ASCII_O))) { + if (parser->m_attlistDeclHandler && parser->m_declAttributeType) { + if (*parser->m_declAttributeType == XML_T(ASCII_LPAREN) + || (*parser->m_declAttributeType == XML_T(ASCII_N) + && parser->m_declAttributeType[1] == XML_T(ASCII_O))) { /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) - || !poolAppendChar(&tempPool, XML_T('\0'))) + if (! poolAppendChar(&parser->m_tempPool, XML_T(ASCII_RPAREN)) + || ! poolAppendChar(&parser->m_tempPool, XML_T('\0'))) return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); + parser->m_declAttributeType = parser->m_tempPool.start; + poolFinish(&parser->m_tempPool); } *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - attVal, - role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); - poolClear(&tempPool); + parser->m_attlistDeclHandler( + parser->m_handlerArg, parser->m_declElementType->name, + parser->m_declAttributeId->name, parser->m_declAttributeType, + attVal, role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); + poolClear(&parser->m_tempPool); handleDefault = XML_FALSE; } } break; case XML_ROLE_ENTITY_VALUE: if (dtd->keepProcessing) { - enum XML_Error result = storeEntityValue(parser, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (declEntity) { - declEntity->textPtr = poolStart(&dtd->entityValuePool); - declEntity->textLen = (int)(poolLength(&dtd->entityValuePool)); + enum XML_Error result + = storeEntityValue(parser, enc, s + enc->minBytesPerChar, + next - enc->minBytesPerChar, XML_ACCOUNT_NONE); + if (parser->m_declEntity) { + parser->m_declEntity->textPtr = poolStart(&dtd->entityValuePool); + parser->m_declEntity->textLen + = (int)(poolLength(&dtd->entityValuePool)); poolFinish(&dtd->entityValuePool); - if (entityDeclHandler) { + if (parser->m_entityDeclHandler) { *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - declEntity->textPtr, - declEntity->textLen, - curBase, 0, 0, 0); + parser->m_entityDeclHandler( + parser->m_handlerArg, parser->m_declEntity->name, + parser->m_declEntity->is_param, parser->m_declEntity->textPtr, + parser->m_declEntity->textLen, parser->m_curBase, 0, 0, 0); handleDefault = XML_FALSE; } - } - else + } else poolDiscard(&dtd->entityValuePool); if (result != XML_ERROR_NONE) return result; @@ -4212,227 +5049,212 @@ doProlog(XML_Parser parser, break; case XML_ROLE_DOCTYPE_SYSTEM_ID: #ifdef XML_DTD - useForeignDTD = XML_FALSE; + parser->m_useForeignDTD = XML_FALSE; #endif /* XML_DTD */ dtd->hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - doctypeSysid = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (doctypeSysid == NULL) + if (parser->m_startDoctypeDeclHandler) { + parser->m_doctypeSysid = poolStoreString(&parser->m_tempPool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (parser->m_doctypeSysid == NULL) return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); + poolFinish(&parser->m_tempPool); handleDefault = XML_FALSE; } #ifdef XML_DTD else - /* use externalSubsetName to make doctypeSysid non-NULL - for the case where no startDoctypeDeclHandler is set */ - doctypeSysid = externalSubsetName; + /* use externalSubsetName to make parser->m_doctypeSysid non-NULL + for the case where no parser->m_startDoctypeDeclHandler is set */ + parser->m_doctypeSysid = externalSubsetName; #endif /* XML_DTD */ - if (!dtd->standalone + if (! dtd->standalone #ifdef XML_DTD - && !paramEntityParsing + && ! parser->m_paramEntityParsing #endif /* XML_DTD */ - && notStandaloneHandler - && !notStandaloneHandler(handlerArg)) + && parser->m_notStandaloneHandler + && ! parser->m_notStandaloneHandler(parser->m_handlerArg)) return XML_ERROR_NOT_STANDALONE; #ifndef XML_DTD break; -#else /* XML_DTD */ - if (!declEntity) { - declEntity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) +#else /* XML_DTD */ + if (! parser->m_declEntity) { + parser->m_declEntity = (ENTITY *)lookup( + parser, &dtd->paramEntities, externalSubsetName, sizeof(ENTITY)); + if (! parser->m_declEntity) return XML_ERROR_NO_MEMORY; - declEntity->publicId = NULL; + parser->m_declEntity->publicId = NULL; } - /* fall through */ #endif /* XML_DTD */ + /* fall through */ case XML_ROLE_ENTITY_SYSTEM_ID: - if (dtd->keepProcessing && declEntity) { - declEntity->systemId = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!declEntity->systemId) + if (dtd->keepProcessing && parser->m_declEntity) { + parser->m_declEntity->systemId + = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (! parser->m_declEntity->systemId) return XML_ERROR_NO_MEMORY; - declEntity->base = curBase; + parser->m_declEntity->base = parser->m_curBase; poolFinish(&dtd->pool); - if (entityDeclHandler) + /* Don't suppress the default handler if we fell through from + * the XML_ROLE_DOCTYPE_SYSTEM_ID case. + */ + if (parser->m_entityDeclHandler && role == XML_ROLE_ENTITY_SYSTEM_ID) handleDefault = XML_FALSE; } break; case XML_ROLE_ENTITY_COMPLETE: - if (dtd->keepProcessing && declEntity && entityDeclHandler) { + if (dtd->keepProcessing && parser->m_declEntity + && parser->m_entityDeclHandler) { *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - 0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - 0); + parser->m_entityDeclHandler( + parser->m_handlerArg, parser->m_declEntity->name, + parser->m_declEntity->is_param, 0, 0, parser->m_declEntity->base, + parser->m_declEntity->systemId, parser->m_declEntity->publicId, 0); handleDefault = XML_FALSE; } break; case XML_ROLE_ENTITY_NOTATION_NAME: - if (dtd->keepProcessing && declEntity) { - declEntity->notation = poolStoreString(&dtd->pool, enc, s, next); - if (!declEntity->notation) + if (dtd->keepProcessing && parser->m_declEntity) { + parser->m_declEntity->notation + = poolStoreString(&dtd->pool, enc, s, next); + if (! parser->m_declEntity->notation) return XML_ERROR_NO_MEMORY; poolFinish(&dtd->pool); - if (unparsedEntityDeclHandler) { + if (parser->m_unparsedEntityDeclHandler) { *eventEndPP = s; - unparsedEntityDeclHandler(handlerArg, - declEntity->name, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); + parser->m_unparsedEntityDeclHandler( + parser->m_handlerArg, parser->m_declEntity->name, + parser->m_declEntity->base, parser->m_declEntity->systemId, + parser->m_declEntity->publicId, parser->m_declEntity->notation); handleDefault = XML_FALSE; - } - else if (entityDeclHandler) { + } else if (parser->m_entityDeclHandler) { *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - 0,0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); + parser->m_entityDeclHandler( + parser->m_handlerArg, parser->m_declEntity->name, 0, 0, 0, + parser->m_declEntity->base, parser->m_declEntity->systemId, + parser->m_declEntity->publicId, parser->m_declEntity->notation); handleDefault = XML_FALSE; } } break; - case XML_ROLE_GENERAL_ENTITY_NAME: - { - if (XmlPredefinedEntityName(enc, s, next)) { - declEntity = NULL; - break; - } - if (dtd->keepProcessing) { - const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - else { - poolFinish(&dtd->pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_FALSE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { + case XML_ROLE_GENERAL_ENTITY_NAME: { + if (XmlPredefinedEntityName(enc, s, next)) { + parser->m_declEntity = NULL; + break; + } + if (dtd->keepProcessing) { + const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); + if (! name) + return XML_ERROR_NO_MEMORY; + parser->m_declEntity = (ENTITY *)lookup(parser, &dtd->generalEntities, + name, sizeof(ENTITY)); + if (! parser->m_declEntity) + return XML_ERROR_NO_MEMORY; + if (parser->m_declEntity->name != name) { poolDiscard(&dtd->pool); - declEntity = NULL; + parser->m_declEntity = NULL; + } else { + poolFinish(&dtd->pool); + parser->m_declEntity->publicId = NULL; + parser->m_declEntity->is_param = XML_FALSE; + /* if we have a parent parser or are reading an internal parameter + entity, then the entity declaration is not considered "internal" + */ + parser->m_declEntity->is_internal + = ! (parser->m_parentParser || parser->m_openInternalEntities); + if (parser->m_entityDeclHandler) + handleDefault = XML_FALSE; } + } else { + poolDiscard(&dtd->pool); + parser->m_declEntity = NULL; } - break; + } break; case XML_ROLE_PARAM_ENTITY_NAME: #ifdef XML_DTD if (dtd->keepProcessing) { const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); - if (!name) + if (! name) return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities, - name, sizeof(ENTITY)); - if (!declEntity) + parser->m_declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities, + name, sizeof(ENTITY)); + if (! parser->m_declEntity) return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { + if (parser->m_declEntity->name != name) { poolDiscard(&dtd->pool); - declEntity = NULL; - } - else { + parser->m_declEntity = NULL; + } else { poolFinish(&dtd->pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_TRUE; + parser->m_declEntity->publicId = NULL; + parser->m_declEntity->is_param = XML_TRUE; /* if we have a parent parser or are reading an internal parameter entity, then the entity declaration is not considered "internal" */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) + parser->m_declEntity->is_internal + = ! (parser->m_parentParser || parser->m_openInternalEntities); + if (parser->m_entityDeclHandler) handleDefault = XML_FALSE; } - } - else { + } else { poolDiscard(&dtd->pool); - declEntity = NULL; + parser->m_declEntity = NULL; } -#else /* not XML_DTD */ - declEntity = NULL; +#else /* not XML_DTD */ + parser->m_declEntity = NULL; #endif /* XML_DTD */ break; case XML_ROLE_NOTATION_NAME: - declNotationPublicId = NULL; - declNotationName = NULL; - if (notationDeclHandler) { - declNotationName = poolStoreString(&tempPool, enc, s, next); - if (!declNotationName) + parser->m_declNotationPublicId = NULL; + parser->m_declNotationName = NULL; + if (parser->m_notationDeclHandler) { + parser->m_declNotationName + = poolStoreString(&parser->m_tempPool, enc, s, next); + if (! parser->m_declNotationName) return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); + poolFinish(&parser->m_tempPool); handleDefault = XML_FALSE; } break; case XML_ROLE_NOTATION_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) + if (! XmlIsPublicId(enc, s, next, eventPP)) return XML_ERROR_PUBLICID; - if (declNotationName) { /* means notationDeclHandler != NULL */ - XML_Char *tem = poolStoreString(&tempPool, - enc, + if (parser + ->m_declNotationName) { /* means m_notationDeclHandler != NULL */ + XML_Char *tem = poolStoreString(&parser->m_tempPool, enc, s + enc->minBytesPerChar, next - enc->minBytesPerChar); - if (!tem) + if (! tem) return XML_ERROR_NO_MEMORY; normalizePublicId(tem); - declNotationPublicId = tem; - poolFinish(&tempPool); + parser->m_declNotationPublicId = tem; + poolFinish(&parser->m_tempPool); handleDefault = XML_FALSE; } break; case XML_ROLE_NOTATION_SYSTEM_ID: - if (declNotationName && notationDeclHandler) { - const XML_Char *systemId - = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!systemId) + if (parser->m_declNotationName && parser->m_notationDeclHandler) { + const XML_Char *systemId = poolStoreString(&parser->m_tempPool, enc, + s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (! systemId) return XML_ERROR_NO_MEMORY; *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - systemId, - declNotationPublicId); + parser->m_notationDeclHandler( + parser->m_handlerArg, parser->m_declNotationName, parser->m_curBase, + systemId, parser->m_declNotationPublicId); handleDefault = XML_FALSE; } - poolClear(&tempPool); + poolClear(&parser->m_tempPool); break; case XML_ROLE_NOTATION_NO_SYSTEM_ID: - if (declNotationPublicId && notationDeclHandler) { + if (parser->m_declNotationPublicId && parser->m_notationDeclHandler) { *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - 0, - declNotationPublicId); + parser->m_notationDeclHandler( + parser->m_handlerArg, parser->m_declNotationName, parser->m_curBase, + 0, parser->m_declNotationPublicId); handleDefault = XML_FALSE; } - poolClear(&tempPool); + poolClear(&parser->m_tempPool); break; case XML_ROLE_ERROR: switch (tok) { @@ -4446,90 +5268,110 @@ doProlog(XML_Parser parser, return XML_ERROR_SYNTAX; } #ifdef XML_DTD - case XML_ROLE_IGNORE_SECT: - { - enum XML_Error result; - if (defaultHandler) - reportDefault(parser, enc, s, next); - handleDefault = XML_FALSE; - result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore); - if (result != XML_ERROR_NONE) - return result; - else if (!next) { - processor = ignoreSectionProcessor; - return result; - } + case XML_ROLE_IGNORE_SECT: { + enum XML_Error result; + if (parser->m_defaultHandler) + reportDefault(parser, enc, s, next); + handleDefault = XML_FALSE; + result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore); + if (result != XML_ERROR_NONE) + return result; + else if (! next) { + parser->m_processor = ignoreSectionProcessor; + return result; } - break; + } break; #endif /* XML_DTD */ case XML_ROLE_GROUP_OPEN: - if (prologState.level >= groupSize) { - if (groupSize) { - char *temp = (char *)REALLOC(groupConnector, groupSize *= 2); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - groupConnector = temp; - if (dtd->scaffIndex) { - int *temp = (int *)REALLOC(dtd->scaffIndex, - groupSize * sizeof(int)); - if (temp == NULL) + if (parser->m_prologState.level >= parser->m_groupSize) { + if (parser->m_groupSize) { + { + /* Detect and prevent integer overflow */ + if (parser->m_groupSize > (unsigned int)(-1) / 2u) { return XML_ERROR_NO_MEMORY; - dtd->scaffIndex = temp; + } + + char *const new_connector = (char *)REALLOC( + parser, parser->m_groupConnector, parser->m_groupSize *= 2); + if (new_connector == NULL) { + parser->m_groupSize /= 2; + return XML_ERROR_NO_MEMORY; + } + parser->m_groupConnector = new_connector; + } + + if (dtd->scaffIndex) { + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if (parser->m_groupSize > (size_t)(-1) / sizeof(int)) { + return XML_ERROR_NO_MEMORY; + } +#endif + + int *const new_scaff_index = (int *)REALLOC( + parser, dtd->scaffIndex, parser->m_groupSize * sizeof(int)); + if (new_scaff_index == NULL) + return XML_ERROR_NO_MEMORY; + dtd->scaffIndex = new_scaff_index; + } + } else { + parser->m_groupConnector + = (char *)MALLOC(parser, parser->m_groupSize = 32); + if (! parser->m_groupConnector) { + parser->m_groupSize = 0; + return XML_ERROR_NO_MEMORY; } } - else { - groupConnector = (char *)MALLOC(groupSize = 32); - if (!groupConnector) - return XML_ERROR_NO_MEMORY; - } } - groupConnector[prologState.level] = 0; + parser->m_groupConnector[parser->m_prologState.level] = 0; if (dtd->in_eldecl) { int myindex = nextScaffoldPart(parser); if (myindex < 0) return XML_ERROR_NO_MEMORY; + assert(dtd->scaffIndex != NULL); dtd->scaffIndex[dtd->scaffLevel] = myindex; dtd->scaffLevel++; dtd->scaffold[myindex].type = XML_CTYPE_SEQ; - if (elementDeclHandler) + if (parser->m_elementDeclHandler) handleDefault = XML_FALSE; } break; case XML_ROLE_GROUP_SEQUENCE: - if (groupConnector[prologState.level] == ASCII_PIPE) + if (parser->m_groupConnector[parser->m_prologState.level] == ASCII_PIPE) return XML_ERROR_SYNTAX; - groupConnector[prologState.level] = ASCII_COMMA; - if (dtd->in_eldecl && elementDeclHandler) + parser->m_groupConnector[parser->m_prologState.level] = ASCII_COMMA; + if (dtd->in_eldecl && parser->m_elementDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_GROUP_CHOICE: - if (groupConnector[prologState.level] == ASCII_COMMA) + if (parser->m_groupConnector[parser->m_prologState.level] == ASCII_COMMA) return XML_ERROR_SYNTAX; if (dtd->in_eldecl - && !groupConnector[prologState.level] + && ! parser->m_groupConnector[parser->m_prologState.level] && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - != XML_CTYPE_MIXED) - ) { + != XML_CTYPE_MIXED)) { dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type = XML_CTYPE_CHOICE; - if (elementDeclHandler) + if (parser->m_elementDeclHandler) handleDefault = XML_FALSE; } - groupConnector[prologState.level] = ASCII_PIPE; + parser->m_groupConnector[parser->m_prologState.level] = ASCII_PIPE; break; case XML_ROLE_PARAM_ENTITY_REF: #ifdef XML_DTD case XML_ROLE_INNER_PARAM_ENTITY_REF: dtd->hasParamEntityRefs = XML_TRUE; - if (!paramEntityParsing) + if (! parser->m_paramEntityParsing) dtd->keepProcessing = dtd->standalone; else { const XML_Char *name; ENTITY *entity; - name = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) + name = poolStoreString(&dtd->pool, enc, s + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (! name) return XML_ERROR_NO_MEMORY; entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); poolDiscard(&dtd->pool); @@ -4537,20 +5379,40 @@ doProlog(XML_Parser parser, if yes, check that the entity exists, and that it is internal, otherwise call the skipped entity handler */ - if (prologState.documentEntity && - (dtd->standalone - ? !openInternalEntities - : !dtd->hasParamEntityRefs)) { - if (!entity) + if (parser->m_prologState.documentEntity + && (dtd->standalone ? ! parser->m_openInternalEntities + : ! dtd->hasParamEntityRefs)) { + if (! entity) return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { + else if (! entity->is_internal) { + /* It's hard to exhaustively search the code to be sure, + * but there doesn't seem to be a way of executing the + * following line. There are two cases: + * + * If 'standalone' is false, the DTD must have no + * parameter entities or we wouldn't have passed the outer + * 'if' statement. That means the only entity in the hash + * table is the external subset name "#" which cannot be + * given as a parameter entity name in XML syntax, so the + * lookup must have returned NULL and we don't even reach + * the test for an internal entity. + * + * If 'standalone' is true, it does not seem to be + * possible to create entities taking this code path that + * are not internal entities, so fail the test above. + * + * Because this analysis is very uncertain, the code is + * being left in place and merely removed from the + * coverage test statistics. + */ + return XML_ERROR_ENTITY_DECLARED_IN_PE; /* LCOV_EXCL_LINE */ + } + } else if (! entity) { dtd->keepProcessing = dtd->standalone; /* cannot report skipped entities in declarations */ - if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) { - skippedEntityHandler(handlerArg, name, 1); + if ((role == XML_ROLE_PARAM_ENTITY_REF) + && parser->m_skippedEntityHandler) { + parser->m_skippedEntityHandler(parser->m_handlerArg, name, 1); handleDefault = XML_FALSE; } break; @@ -4559,50 +5421,49 @@ doProlog(XML_Parser parser, return XML_ERROR_RECURSIVE_ENTITY_REF; if (entity->textPtr) { enum XML_Error result; - XML_Bool betweenDecl = - (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE); + XML_Bool betweenDecl + = (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE); result = processInternalEntity(parser, entity, betweenDecl); if (result != XML_ERROR_NONE) return result; handleDefault = XML_FALSE; break; } - if (externalEntityRefHandler) { + if (parser->m_externalEntityRefHandler) { dtd->paramEntityRead = XML_FALSE; entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { + entityTrackingOnOpen(parser, entity, __LINE__); + if (! parser->m_externalEntityRefHandler( + parser->m_externalEntityRefHandlerArg, 0, entity->base, + entity->systemId, entity->publicId)) { + entityTrackingOnClose(parser, entity, __LINE__); entity->open = XML_FALSE; return XML_ERROR_EXTERNAL_ENTITY_HANDLING; } + entityTrackingOnClose(parser, entity, __LINE__); entity->open = XML_FALSE; handleDefault = XML_FALSE; - if (!dtd->paramEntityRead) { + if (! dtd->paramEntityRead) { dtd->keepProcessing = dtd->standalone; break; } - } - else { + } else { dtd->keepProcessing = dtd->standalone; break; } } #endif /* XML_DTD */ - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) + if (! dtd->standalone && parser->m_notStandaloneHandler + && ! parser->m_notStandaloneHandler(parser->m_handlerArg)) return XML_ERROR_NOT_STANDALONE; break; - /* Element declaration stuff */ + /* Element declaration stuff */ case XML_ROLE_ELEMENT_NAME: - if (elementDeclHandler) { - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) + if (parser->m_elementDeclHandler) { + parser->m_declElementType = getElementType(parser, enc, s, next); + if (! parser->m_declElementType) return XML_ERROR_NO_MEMORY; dtd->scaffLevel = 0; dtd->scaffCount = 0; @@ -4614,19 +5475,20 @@ doProlog(XML_Parser parser, case XML_ROLE_CONTENT_ANY: case XML_ROLE_CONTENT_EMPTY: if (dtd->in_eldecl) { - if (elementDeclHandler) { - XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content)); - if (!content) + if (parser->m_elementDeclHandler) { + XML_Content *content + = (XML_Content *)MALLOC(parser, sizeof(XML_Content)); + if (! content) return XML_ERROR_NO_MEMORY; content->quant = XML_CQUANT_NONE; content->name = NULL; content->numchildren = 0; content->children = NULL; - content->type = ((role == XML_ROLE_CONTENT_ANY) ? - XML_CTYPE_ANY : - XML_CTYPE_EMPTY); + content->type = ((role == XML_ROLE_CONTENT_ANY) ? XML_CTYPE_ANY + : XML_CTYPE_EMPTY); *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, content); + parser->m_elementDeclHandler( + parser->m_handlerArg, parser->m_declElementType->name, content); handleDefault = XML_FALSE; } dtd->in_eldecl = XML_FALSE; @@ -4637,7 +5499,7 @@ doProlog(XML_Parser parser, if (dtd->in_eldecl) { dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type = XML_CTYPE_MIXED; - if (elementDeclHandler) + if (parser->m_elementDeclHandler) handleDefault = XML_FALSE; } break; @@ -4657,24 +5519,30 @@ doProlog(XML_Parser parser, if (dtd->in_eldecl) { ELEMENT_TYPE *el; const XML_Char *name; - int nameLen; - const char *nxt = (quant == XML_CQUANT_NONE - ? next - : next - enc->minBytesPerChar); + size_t nameLen; + const char *nxt + = (quant == XML_CQUANT_NONE ? next : next - enc->minBytesPerChar); int myindex = nextScaffoldPart(parser); if (myindex < 0) return XML_ERROR_NO_MEMORY; dtd->scaffold[myindex].type = XML_CTYPE_NAME; dtd->scaffold[myindex].quant = quant; el = getElementType(parser, enc, s, nxt); - if (!el) + if (! el) return XML_ERROR_NO_MEMORY; name = el->name; dtd->scaffold[myindex].name = name; nameLen = 0; - for (; name[nameLen++]; ); - dtd->contentStringLen += nameLen; - if (elementDeclHandler) + for (; name[nameLen++];) + ; + + /* Detect and prevent integer overflow */ + if (nameLen > UINT_MAX - dtd->contentStringLen) { + return XML_ERROR_NO_MEMORY; + } + + dtd->contentStringLen += (unsigned)nameLen; + if (parser->m_elementDeclHandler) handleDefault = XML_FALSE; } break; @@ -4692,17 +5560,18 @@ doProlog(XML_Parser parser, quant = XML_CQUANT_PLUS; closeGroup: if (dtd->in_eldecl) { - if (elementDeclHandler) + if (parser->m_elementDeclHandler) handleDefault = XML_FALSE; dtd->scaffLevel--; dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant; if (dtd->scaffLevel == 0) { - if (!handleDefault) { + if (! handleDefault) { XML_Content *model = build_model(parser); - if (!model) + if (! model) return XML_ERROR_NO_MEMORY; *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, model); + parser->m_elementDeclHandler( + parser->m_handlerArg, parser->m_declElementType->name, model); } dtd->in_eldecl = XML_FALSE; dtd->contentStringLen = 0; @@ -4712,12 +5581,12 @@ doProlog(XML_Parser parser, /* End element declaration stuff */ case XML_ROLE_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) + if (! reportProcessingInstruction(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; handleDefault = XML_FALSE; break; case XML_ROLE_COMMENT: - if (!reportComment(parser, enc, s, next)) + if (! reportComment(parser, enc, s, next)) return XML_ERROR_NO_MEMORY; handleDefault = XML_FALSE; break; @@ -4729,31 +5598,31 @@ doProlog(XML_Parser parser, } break; case XML_ROLE_DOCTYPE_NONE: - if (startDoctypeDeclHandler) + if (parser->m_startDoctypeDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_ENTITY_NONE: - if (dtd->keepProcessing && entityDeclHandler) + if (dtd->keepProcessing && parser->m_entityDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_NOTATION_NONE: - if (notationDeclHandler) + if (parser->m_notationDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_ATTLIST_NONE: - if (dtd->keepProcessing && attlistDeclHandler) + if (dtd->keepProcessing && parser->m_attlistDeclHandler) handleDefault = XML_FALSE; break; case XML_ROLE_ELEMENT_NONE: - if (elementDeclHandler) + if (parser->m_elementDeclHandler) handleDefault = XML_FALSE; break; } /* end of big switch */ - if (handleDefault && defaultHandler) + if (handleDefault && parser->m_defaultHandler) reportDefault(parser, enc, s, next); - switch (ps_parsing) { + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; @@ -4768,23 +5637,27 @@ doProlog(XML_Parser parser, } static enum XML_Error PTRCALL -epilogProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - processor = epilogProcessor; - eventPtr = s; +epilogProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { + parser->m_processor = epilogProcessor; + parser->m_eventPtr = s; for (;;) { const char *next = NULL; - int tok = XmlPrologTok(encoding, s, end, &next); - eventEndPtr = next; + int tok = XmlPrologTok(parser->m_encoding, s, end, &next); +#ifdef XML_DTD + if (! accountingDiffTolerated(parser, tok, s, next, __LINE__, + XML_ACCOUNT_DIRECT)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } +#endif + parser->m_eventEndPtr = next; switch (tok) { /* report partial linebreak - it might be the last token */ case -XML_TOK_PROLOG_S: - if (defaultHandler) { - reportDefault(parser, encoding, s, next); - if (ps_parsing == XML_FINISHED) + if (parser->m_defaultHandler) { + reportDefault(parser, parser->m_encoding, s, next); + if (parser->m_parsingStatus.parsing == XML_FINISHED) return XML_ERROR_ABORTED; } *nextPtr = next; @@ -4793,28 +5666,28 @@ epilogProcessor(XML_Parser parser, *nextPtr = s; return XML_ERROR_NONE; case XML_TOK_PROLOG_S: - if (defaultHandler) - reportDefault(parser, encoding, s, next); + if (parser->m_defaultHandler) + reportDefault(parser, parser->m_encoding, s, next); break; case XML_TOK_PI: - if (!reportProcessingInstruction(parser, encoding, s, next)) + if (! reportProcessingInstruction(parser, parser->m_encoding, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_COMMENT: - if (!reportComment(parser, encoding, s, next)) + if (! reportComment(parser, parser->m_encoding, s, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_INVALID: - eventPtr = next; + parser->m_eventPtr = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { + if (! parser->m_parsingStatus.finalBuffer) { *nextPtr = s; return XML_ERROR_NONE; } return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { + if (! parser->m_parsingStatus.finalBuffer) { *nextPtr = s; return XML_ERROR_NONE; } @@ -4822,209 +5695,245 @@ epilogProcessor(XML_Parser parser, default: return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; } - eventPtr = s = next; - switch (ps_parsing) { + parser->m_eventPtr = s = next; + switch (parser->m_parsingStatus.parsing) { case XML_SUSPENDED: *nextPtr = next; return XML_ERROR_NONE; case XML_FINISHED: return XML_ERROR_ABORTED; - default: ; + default:; } } } static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, - XML_Bool betweenDecl) -{ +processInternalEntity(XML_Parser parser, ENTITY *entity, XML_Bool betweenDecl) { const char *textStart, *textEnd; const char *next; enum XML_Error result; OPEN_INTERNAL_ENTITY *openEntity; - if (freeInternalEntities) { - openEntity = freeInternalEntities; - freeInternalEntities = openEntity->next; - } - else { - openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(sizeof(OPEN_INTERNAL_ENTITY)); - if (!openEntity) + if (parser->m_freeInternalEntities) { + openEntity = parser->m_freeInternalEntities; + parser->m_freeInternalEntities = openEntity->next; + } else { + openEntity + = (OPEN_INTERNAL_ENTITY *)MALLOC(parser, sizeof(OPEN_INTERNAL_ENTITY)); + if (! openEntity) return XML_ERROR_NO_MEMORY; } entity->open = XML_TRUE; +#ifdef XML_DTD + entityTrackingOnOpen(parser, entity, __LINE__); +#endif entity->processed = 0; - openEntity->next = openInternalEntities; - openInternalEntities = openEntity; + openEntity->next = parser->m_openInternalEntities; + parser->m_openInternalEntities = openEntity; openEntity->entity = entity; - openEntity->startTagLevel = tagLevel; + openEntity->startTagLevel = parser->m_tagLevel; openEntity->betweenDecl = betweenDecl; openEntity->internalEventPtr = NULL; openEntity->internalEventEndPtr = NULL; - textStart = (char *)entity->textPtr; - textEnd = (char *)(entity->textPtr + entity->textLen); + textStart = (const char *)entity->textPtr; + textEnd = (const char *)(entity->textPtr + entity->textLen); + /* Set a safe default value in case 'next' does not get set */ + next = textStart; #ifdef XML_DTD if (entity->is_param) { - int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); - result = doProlog(parser, internalEncoding, textStart, textEnd, tok, - next, &next, XML_FALSE); - } - else + int tok + = XmlPrologTok(parser->m_internalEncoding, textStart, textEnd, &next); + result = doProlog(parser, parser->m_internalEncoding, textStart, textEnd, + tok, next, &next, XML_FALSE, XML_FALSE, + XML_ACCOUNT_ENTITY_EXPANSION); + } else #endif /* XML_DTD */ - result = doContent(parser, tagLevel, internalEncoding, textStart, - textEnd, &next, XML_FALSE); + result = doContent(parser, parser->m_tagLevel, parser->m_internalEncoding, + textStart, textEnd, &next, XML_FALSE, + XML_ACCOUNT_ENTITY_EXPANSION); if (result == XML_ERROR_NONE) { - if (textEnd != next && ps_parsing == XML_SUSPENDED) { + if (textEnd != next && parser->m_parsingStatus.parsing == XML_SUSPENDED) { entity->processed = (int)(next - textStart); - processor = internalEntityProcessor; - } - else { + parser->m_processor = internalEntityProcessor; + } else { +#ifdef XML_DTD + entityTrackingOnClose(parser, entity, __LINE__); +#endif /* XML_DTD */ entity->open = XML_FALSE; - openInternalEntities = openEntity->next; + parser->m_openInternalEntities = openEntity->next; /* put openEntity back in list of free instances */ - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; + openEntity->next = parser->m_freeInternalEntities; + parser->m_freeInternalEntities = openEntity; } } return result; } static enum XML_Error PTRCALL -internalEntityProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ +internalEntityProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { ENTITY *entity; const char *textStart, *textEnd; const char *next; enum XML_Error result; - OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities; - if (!openEntity) + OPEN_INTERNAL_ENTITY *openEntity = parser->m_openInternalEntities; + if (! openEntity) return XML_ERROR_UNEXPECTED_STATE; entity = openEntity->entity; - textStart = ((char *)entity->textPtr) + entity->processed; - textEnd = (char *)(entity->textPtr + entity->textLen); + textStart = ((const char *)entity->textPtr) + entity->processed; + textEnd = (const char *)(entity->textPtr + entity->textLen); + /* Set a safe default value in case 'next' does not get set */ + next = textStart; #ifdef XML_DTD if (entity->is_param) { - int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); - result = doProlog(parser, internalEncoding, textStart, textEnd, tok, - next, &next, XML_FALSE); - } - else + int tok + = XmlPrologTok(parser->m_internalEncoding, textStart, textEnd, &next); + result = doProlog(parser, parser->m_internalEncoding, textStart, textEnd, + tok, next, &next, XML_FALSE, XML_TRUE, + XML_ACCOUNT_ENTITY_EXPANSION); + } else #endif /* XML_DTD */ - result = doContent(parser, openEntity->startTagLevel, internalEncoding, - textStart, textEnd, &next, XML_FALSE); + result = doContent(parser, openEntity->startTagLevel, + parser->m_internalEncoding, textStart, textEnd, &next, + XML_FALSE, XML_ACCOUNT_ENTITY_EXPANSION); if (result != XML_ERROR_NONE) return result; - else if (textEnd != next && ps_parsing == XML_SUSPENDED) { - entity->processed = (int)(next - (char *)entity->textPtr); + + if (textEnd != next && parser->m_parsingStatus.parsing == XML_SUSPENDED) { + entity->processed = (int)(next - (const char *)entity->textPtr); return result; } - else { - entity->open = XML_FALSE; - openInternalEntities = openEntity->next; - /* put openEntity back in list of free instances */ - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; + +#ifdef XML_DTD + entityTrackingOnClose(parser, entity, __LINE__); +#endif + entity->open = XML_FALSE; + parser->m_openInternalEntities = openEntity->next; + /* put openEntity back in list of free instances */ + openEntity->next = parser->m_freeInternalEntities; + parser->m_freeInternalEntities = openEntity; + + // If there are more open entities we want to stop right here and have the + // upcoming call to XML_ResumeParser continue with entity content, or it would + // be ignored altogether. + if (parser->m_openInternalEntities != NULL + && parser->m_parsingStatus.parsing == XML_SUSPENDED) { + return XML_ERROR_NONE; } #ifdef XML_DTD if (entity->is_param) { int tok; - processor = prologProcessor; - tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, nextPtr, - (XML_Bool)!ps_finalBuffer); - } - else + parser->m_processor = prologProcessor; + tok = XmlPrologTok(parser->m_encoding, s, end, &next); + return doProlog(parser, parser->m_encoding, s, end, tok, next, nextPtr, + (XML_Bool)! parser->m_parsingStatus.finalBuffer, XML_TRUE, + XML_ACCOUNT_DIRECT); + } else #endif /* XML_DTD */ { - processor = contentProcessor; + parser->m_processor = contentProcessor; /* see externalEntityContentProcessor vs contentProcessor */ - return doContent(parser, parentParser ? 1 : 0, encoding, s, end, - nextPtr, (XML_Bool)!ps_finalBuffer); + result = doContent(parser, parser->m_parentParser ? 1 : 0, + parser->m_encoding, s, end, nextPtr, + (XML_Bool)! parser->m_parsingStatus.finalBuffer, + XML_ACCOUNT_DIRECT); + if (result == XML_ERROR_NONE) { + if (! storeRawNames(parser)) + return XML_ERROR_NO_MEMORY; + } + return result; } } static enum XML_Error PTRCALL -errorProcessor(XML_Parser parser, - const char *UNUSED_P(s), - const char *UNUSED_P(end), - const char **UNUSED_P(nextPtr)) -{ - return errorCode; +errorProcessor(XML_Parser parser, const char *s, const char *end, + const char **nextPtr) { + UNUSED_P(s); + UNUSED_P(end); + UNUSED_P(nextPtr); + return parser->m_errorCode; } static enum XML_Error storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, - end, pool); + const char *ptr, const char *end, STRING_POOL *pool, + enum XML_Account account) { + enum XML_Error result + = appendAttributeValue(parser, enc, isCdata, ptr, end, pool, account); if (result) return result; - if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) + if (! isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) poolChop(pool); - if (!poolAppendChar(pool, XML_T('\0'))) + if (! poolAppendChar(pool, XML_T('\0'))) return XML_ERROR_NO_MEMORY; return XML_ERROR_NONE; } static enum XML_Error appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ + const char *ptr, const char *end, STRING_POOL *pool, + enum XML_Account account) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ +#ifndef XML_DTD + UNUSED_P(account); +#endif + for (;;) { - const char *next; + const char *next + = ptr; /* XmlAttributeValueTok doesn't always set the last arg */ int tok = XmlAttributeValueTok(enc, ptr, end, &next); +#ifdef XML_DTD + if (! accountingDiffTolerated(parser, tok, ptr, next, __LINE__, account)) { + accountingOnAbort(parser); + return XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + } +#endif switch (tok) { case XML_TOK_NONE: return XML_ERROR_NONE; case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; + if (enc == parser->m_encoding) + parser->m_eventPtr = next; return XML_ERROR_INVALID_TOKEN; case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = ptr; + if (enc == parser->m_encoding) + parser->m_eventPtr = ptr; return XML_ERROR_INVALID_TOKEN; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, ptr); - if (n < 0) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - if (!isCdata - && n == 0x20 /* space */ - && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - for (i = 0; i < n; i++) { - if (!poolAppendChar(pool, buf[i])) - return XML_ERROR_NO_MEMORY; - } + case XML_TOK_CHAR_REF: { + XML_Char buf[XML_ENCODE_MAX]; + int i; + int n = XmlCharRefNumber(enc, ptr); + if (n < 0) { + if (enc == parser->m_encoding) + parser->m_eventPtr = ptr; + return XML_ERROR_BAD_CHAR_REF; } - break; + if (! isCdata && n == 0x20 /* space */ + && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) + break; + n = XmlEncode(n, (ICHAR *)buf); + /* The XmlEncode() functions can never return 0 here. That + * error return happens if the code point passed in is either + * negative or greater than or equal to 0x110000. The + * XmlCharRefNumber() functions will all return a number + * strictly less than 0x110000 or a negative value if an error + * occurred. The negative value is intercepted above, so + * XmlEncode() is never passed a value it might return an + * error for. + */ + for (i = 0; i < n; i++) { + if (! poolAppendChar(pool, buf[i])) + return XML_ERROR_NO_MEMORY; + } + } break; case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, ptr, next)) + if (! poolAppend(pool, enc, ptr, next)) return XML_ERROR_NO_MEMORY; break; case XML_TOK_TRAILING_CR: @@ -5032,95 +5941,134 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, /* fall through */ case XML_TOK_ATTRIBUTE_VALUE_S: case XML_TOK_DATA_NEWLINE: - if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) + if (! isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) break; - if (!poolAppendChar(pool, 0x20)) + if (! poolAppendChar(pool, 0x20)) return XML_ERROR_NO_MEMORY; break; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - char checkEntityDecl; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (!poolAppendChar(pool, ch)) - return XML_ERROR_NO_MEMORY; - break; - } - name = poolStoreString(&temp2Pool, enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); - poolDiscard(&temp2Pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal. - */ - if (pool == &dtd->pool) /* are we called from prolog? */ - checkEntityDecl = + case XML_TOK_ENTITY_REF: { + const XML_Char *name; + ENTITY *entity; + char checkEntityDecl; + XML_Char ch = (XML_Char)XmlPredefinedEntityName( + enc, ptr + enc->minBytesPerChar, next - enc->minBytesPerChar); + if (ch) { #ifdef XML_DTD - prologState.documentEntity && + /* NOTE: We are replacing 4-6 characters original input for 1 character + * so there is no amplification and hence recording without + * protection. */ + accountingDiffTolerated(parser, tok, (char *)&ch, + ((char *)&ch) + sizeof(XML_Char), __LINE__, + XML_ACCOUNT_ENTITY_EXPANSION); #endif /* XML_DTD */ - (dtd->standalone - ? !openInternalEntities - : !dtd->hasParamEntityRefs); - else /* if (pool == &tempPool): we are called from content */ - checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone; - if (checkEntityDecl) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - /* Cannot report skipped entity here - see comments on - skippedEntityHandler. - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - /* Cannot call the default handler because this would be - out of sync with the call to the startElementHandler. - if ((pool == &tempPool) && defaultHandler) - reportDefault(parser, enc, ptr, next); - */ - break; - } - if (entity->open) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_RECURSIVE_ENTITY_REF; - } - if (entity->notation) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BINARY_ENTITY_REF; - } - if (!entity->textPtr) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; - } - else { - enum XML_Error result; - const XML_Char *textEnd = entity->textPtr + entity->textLen; - entity->open = XML_TRUE; - result = appendAttributeValue(parser, internalEncoding, isCdata, - (char *)entity->textPtr, - (char *)textEnd, pool); - entity->open = XML_FALSE; - if (result) - return result; - } + if (! poolAppendChar(pool, ch)) + return XML_ERROR_NO_MEMORY; + break; } - break; + name = poolStoreString(&parser->m_temp2Pool, enc, + ptr + enc->minBytesPerChar, + next - enc->minBytesPerChar); + if (! name) + return XML_ERROR_NO_MEMORY; + entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); + poolDiscard(&parser->m_temp2Pool); + /* First, determine if a check for an existing declaration is needed; + if yes, check that the entity exists, and that it is internal. + */ + if (pool == &dtd->pool) /* are we called from prolog? */ + checkEntityDecl = +#ifdef XML_DTD + parser->m_prologState.documentEntity && +#endif /* XML_DTD */ + (dtd->standalone ? ! parser->m_openInternalEntities + : ! dtd->hasParamEntityRefs); + else /* if (pool == &parser->m_tempPool): we are called from content */ + checkEntityDecl = ! dtd->hasParamEntityRefs || dtd->standalone; + if (checkEntityDecl) { + if (! entity) + return XML_ERROR_UNDEFINED_ENTITY; + else if (! entity->is_internal) + return XML_ERROR_ENTITY_DECLARED_IN_PE; + } else if (! entity) { + /* Cannot report skipped entity here - see comments on + parser->m_skippedEntityHandler. + if (parser->m_skippedEntityHandler) + parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0); + */ + /* Cannot call the default handler because this would be + out of sync with the call to the startElementHandler. + if ((pool == &parser->m_tempPool) && parser->m_defaultHandler) + reportDefault(parser, enc, ptr, next); + */ + break; + } + if (entity->open) { + if (enc == parser->m_encoding) { + /* It does not appear that this line can be executed. + * + * The "if (entity->open)" check catches recursive entity + * definitions. In order to be called with an open + * entity, it must have gone through this code before and + * been through the recursive call to + * appendAttributeValue() some lines below. That call + * sets the local encoding ("enc") to the parser's + * internal encoding (internal_utf8 or internal_utf16), + * which can never be the same as the principle encoding. + * It doesn't appear there is another code path that gets + * here with entity->open being TRUE. + * + * Since it is not certain that this logic is watertight, + * we keep the line and merely exclude it from coverage + * tests. + */ + parser->m_eventPtr = ptr; /* LCOV_EXCL_LINE */ + } + return XML_ERROR_RECURSIVE_ENTITY_REF; + } + if (entity->notation) { + if (enc == parser->m_encoding) + parser->m_eventPtr = ptr; + return XML_ERROR_BINARY_ENTITY_REF; + } + if (! entity->textPtr) { + if (enc == parser->m_encoding) + parser->m_eventPtr = ptr; + return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; + } else { + enum XML_Error result; + const XML_Char *textEnd = entity->textPtr + entity->textLen; + entity->open = XML_TRUE; +#ifdef XML_DTD + entityTrackingOnOpen(parser, entity, __LINE__); +#endif + result = appendAttributeValue(parser, parser->m_internalEncoding, + isCdata, (const char *)entity->textPtr, + (const char *)textEnd, pool, + XML_ACCOUNT_ENTITY_EXPANSION); +#ifdef XML_DTD + entityTrackingOnClose(parser, entity, __LINE__); +#endif + entity->open = XML_FALSE; + if (result) + return result; + } + } break; default: - if (enc == encoding) - eventPtr = ptr; + /* The only token returned by XmlAttributeValueTok() that does + * not have an explicit case here is XML_TOK_PARTIAL_CHAR. + * Getting that would require an entity name to contain an + * incomplete XML character (e.g. \xE2\x82); however previous + * tokenisers will have already recognised and rejected such + * names before XmlAttributeValueTok() gets a look-in. This + * default case should be retained as a safety net, but the code + * excluded from coverage tests. + * + * LCOV_EXCL_START + */ + if (enc == parser->m_encoding) + parser->m_eventPtr = ptr; return XML_ERROR_UNEXPECTED_STATE; + /* LCOV_EXCL_STOP */ } ptr = next; } @@ -5128,87 +6076,98 @@ appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, } static enum XML_Error -storeEntityValue(XML_Parser parser, - const ENCODING *enc, - const char *entityTextPtr, - const char *entityTextEnd) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ +storeEntityValue(XML_Parser parser, const ENCODING *enc, + const char *entityTextPtr, const char *entityTextEnd, + enum XML_Account account) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ STRING_POOL *pool = &(dtd->entityValuePool); enum XML_Error result = XML_ERROR_NONE; #ifdef XML_DTD - int oldInEntityValue = prologState.inEntityValue; - prologState.inEntityValue = 1; + int oldInEntityValue = parser->m_prologState.inEntityValue; + parser->m_prologState.inEntityValue = 1; +#else + UNUSED_P(account); #endif /* XML_DTD */ /* never return Null for the value argument in EntityDeclHandler, since this would indicate an external entity; therefore we have to make sure that entityValuePool.start is not null */ - if (!pool->blocks) { - if (!poolGrow(pool)) + if (! pool->blocks) { + if (! poolGrow(pool)) return XML_ERROR_NO_MEMORY; } for (;;) { - const char *next; + const char *next + = entityTextPtr; /* XmlEntityValueTok doesn't always set the last arg */ int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); + +#ifdef XML_DTD + if (! accountingDiffTolerated(parser, tok, entityTextPtr, next, __LINE__, + account)) { + accountingOnAbort(parser); + result = XML_ERROR_AMPLIFICATION_LIMIT_BREACH; + goto endEntityValue; + } +#endif + switch (tok) { case XML_TOK_PARAM_ENTITY_REF: #ifdef XML_DTD - if (isParamEntity || enc != encoding) { + if (parser->m_isParamEntity || enc != parser->m_encoding) { const XML_Char *name; ENTITY *entity; - name = poolStoreString(&tempPool, enc, + name = poolStoreString(&parser->m_tempPool, enc, entityTextPtr + enc->minBytesPerChar, next - enc->minBytesPerChar); - if (!name) { + if (! name) { result = XML_ERROR_NO_MEMORY; goto endEntityValue; } entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); - poolDiscard(&tempPool); - if (!entity) { + poolDiscard(&parser->m_tempPool); + if (! entity) { /* not a well-formedness error - see XML 1.0: WFC Entity Declared */ /* cannot report skipped entity here - see comments on - skippedEntityHandler - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); + parser->m_skippedEntityHandler + if (parser->m_skippedEntityHandler) + parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0); */ dtd->keepProcessing = dtd->standalone; goto endEntityValue; } if (entity->open) { - if (enc == encoding) - eventPtr = entityTextPtr; + if (enc == parser->m_encoding) + parser->m_eventPtr = entityTextPtr; result = XML_ERROR_RECURSIVE_ENTITY_REF; goto endEntityValue; } if (entity->systemId) { - if (externalEntityRefHandler) { + if (parser->m_externalEntityRefHandler) { dtd->paramEntityRead = XML_FALSE; entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { + entityTrackingOnOpen(parser, entity, __LINE__); + if (! parser->m_externalEntityRefHandler( + parser->m_externalEntityRefHandlerArg, 0, entity->base, + entity->systemId, entity->publicId)) { + entityTrackingOnClose(parser, entity, __LINE__); entity->open = XML_FALSE; result = XML_ERROR_EXTERNAL_ENTITY_HANDLING; goto endEntityValue; } + entityTrackingOnClose(parser, entity, __LINE__); entity->open = XML_FALSE; - if (!dtd->paramEntityRead) + if (! dtd->paramEntityRead) dtd->keepProcessing = dtd->standalone; - } - else + } else dtd->keepProcessing = dtd->standalone; - } - else { + } else { entity->open = XML_TRUE; - result = storeEntityValue(parser, - internalEncoding, - (char *)entity->textPtr, - (char *)(entity->textPtr - + entity->textLen)); + entityTrackingOnOpen(parser, entity, __LINE__); + result = storeEntityValue( + parser, parser->m_internalEncoding, (const char *)entity->textPtr, + (const char *)(entity->textPtr + entity->textLen), + XML_ACCOUNT_ENTITY_EXPANSION); + entityTrackingOnClose(parser, entity, __LINE__); entity->open = XML_FALSE; if (result) goto endEntityValue; @@ -5218,7 +6177,7 @@ storeEntityValue(XML_Parser parser, #endif /* XML_DTD */ /* In the internal subset, PE references are not legal within markup declarations, e.g entity values in this case. */ - eventPtr = entityTextPtr; + parser->m_eventPtr = entityTextPtr; result = XML_ERROR_PARAM_ENTITY_REF; goto endEntityValue; case XML_TOK_NONE: @@ -5226,7 +6185,7 @@ storeEntityValue(XML_Parser parser, goto endEntityValue; case XML_TOK_ENTITY_REF: case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, entityTextPtr, next)) { + if (! poolAppend(pool, enc, entityTextPtr, next)) { result = XML_ERROR_NO_MEMORY; goto endEntityValue; } @@ -5235,67 +6194,75 @@ storeEntityValue(XML_Parser parser, next = entityTextPtr + enc->minBytesPerChar; /* fall through */ case XML_TOK_DATA_NEWLINE: - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; + if (pool->end == pool->ptr && ! poolGrow(pool)) { + result = XML_ERROR_NO_MEMORY; goto endEntityValue; } *(pool->ptr)++ = 0xA; break; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, entityTextPtr); - if (n < 0) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - for (i = 0; i < n; i++) { - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = buf[i]; - } + case XML_TOK_CHAR_REF: { + XML_Char buf[XML_ENCODE_MAX]; + int i; + int n = XmlCharRefNumber(enc, entityTextPtr); + if (n < 0) { + if (enc == parser->m_encoding) + parser->m_eventPtr = entityTextPtr; + result = XML_ERROR_BAD_CHAR_REF; + goto endEntityValue; } - break; + n = XmlEncode(n, (ICHAR *)buf); + /* The XmlEncode() functions can never return 0 here. That + * error return happens if the code point passed in is either + * negative or greater than or equal to 0x110000. The + * XmlCharRefNumber() functions will all return a number + * strictly less than 0x110000 or a negative value if an error + * occurred. The negative value is intercepted above, so + * XmlEncode() is never passed a value it might return an + * error for. + */ + for (i = 0; i < n; i++) { + if (pool->end == pool->ptr && ! poolGrow(pool)) { + result = XML_ERROR_NO_MEMORY; + goto endEntityValue; + } + *(pool->ptr)++ = buf[i]; + } + } break; case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = entityTextPtr; + if (enc == parser->m_encoding) + parser->m_eventPtr = entityTextPtr; result = XML_ERROR_INVALID_TOKEN; goto endEntityValue; case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; + if (enc == parser->m_encoding) + parser->m_eventPtr = next; result = XML_ERROR_INVALID_TOKEN; goto endEntityValue; default: - if (enc == encoding) - eventPtr = entityTextPtr; + /* This default case should be unnecessary -- all the tokens + * that XmlEntityValueTok() can return have their own explicit + * cases -- but should be retained for safety. We do however + * exclude it from the coverage statistics. + * + * LCOV_EXCL_START + */ + if (enc == parser->m_encoding) + parser->m_eventPtr = entityTextPtr; result = XML_ERROR_UNEXPECTED_STATE; goto endEntityValue; + /* LCOV_EXCL_STOP */ } entityTextPtr = next; } endEntityValue: #ifdef XML_DTD - prologState.inEntityValue = oldInEntityValue; + parser->m_prologState.inEntityValue = oldInEntityValue; #endif /* XML_DTD */ return result; } static void FASTCALL -normalizeLines(XML_Char *s) -{ +normalizeLines(XML_Char *s) { XML_Char *p; for (;; s++) { if (*s == XML_T('\0')) @@ -5309,8 +6276,7 @@ normalizeLines(XML_Char *s) *p++ = 0xA; if (*++s == 0xA) s++; - } - else + } else *p++ = *s++; } while (*s); *p = XML_T('\0'); @@ -5318,88 +6284,100 @@ normalizeLines(XML_Char *s) static int reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ + const char *start, const char *end) { const XML_Char *target; XML_Char *data; const char *tem; - if (!processingInstructionHandler) { - if (defaultHandler) + if (! parser->m_processingInstructionHandler) { + if (parser->m_defaultHandler) reportDefault(parser, enc, start, end); return 1; } start += enc->minBytesPerChar * 2; tem = start + XmlNameLength(enc, start); - target = poolStoreString(&tempPool, enc, start, tem); - if (!target) + target = poolStoreString(&parser->m_tempPool, enc, start, tem); + if (! target) return 0; - poolFinish(&tempPool); - data = poolStoreString(&tempPool, enc, - XmlSkipS(enc, tem), - end - enc->minBytesPerChar*2); - if (!data) + poolFinish(&parser->m_tempPool); + data = poolStoreString(&parser->m_tempPool, enc, XmlSkipS(enc, tem), + end - enc->minBytesPerChar * 2); + if (! data) return 0; normalizeLines(data); - processingInstructionHandler(handlerArg, target, data); - poolClear(&tempPool); + parser->m_processingInstructionHandler(parser->m_handlerArg, target, data); + poolClear(&parser->m_tempPool); return 1; } static int -reportComment(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ +reportComment(XML_Parser parser, const ENCODING *enc, const char *start, + const char *end) { XML_Char *data; - if (!commentHandler) { - if (defaultHandler) + if (! parser->m_commentHandler) { + if (parser->m_defaultHandler) reportDefault(parser, enc, start, end); return 1; } - data = poolStoreString(&tempPool, - enc, + data = poolStoreString(&parser->m_tempPool, enc, start + enc->minBytesPerChar * 4, end - enc->minBytesPerChar * 3); - if (!data) + if (! data) return 0; normalizeLines(data); - commentHandler(handlerArg, data); - poolClear(&tempPool); + parser->m_commentHandler(parser->m_handlerArg, data); + poolClear(&parser->m_tempPool); return 1; } static void -reportDefault(XML_Parser parser, const ENCODING *enc, - const char *s, const char *end) -{ +reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, + const char *end) { if (MUST_CONVERT(enc, s)) { enum XML_Convert_Result convert_res; const char **eventPP; const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); + if (enc == parser->m_encoding) { + eventPP = &parser->m_eventPtr; + eventEndPP = &parser->m_eventEndPtr; + } else { + /* To get here, two things must be true; the parser must be + * using a character encoding that is not the same as the + * encoding passed in, and the encoding passed in must need + * conversion to the internal format (UTF-8 unless XML_UNICODE + * is defined). The only occasions on which the encoding passed + * in is not the same as the parser's encoding are when it is + * the internal encoding (e.g. a previously defined parameter + * entity, already converted to internal format). This by + * definition doesn't need conversion, so the whole branch never + * gets executed. + * + * For safety's sake we don't delete these lines and merely + * exclude them from coverage statistics. + * + * LCOV_EXCL_START + */ + eventPP = &(parser->m_openInternalEntities->internalEventPtr); + eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr); + /* LCOV_EXCL_STOP */ } do { - ICHAR *dataPtr = (ICHAR *)dataBuf; - convert_res = XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); + ICHAR *dataPtr = (ICHAR *)parser->m_dataBuf; + convert_res + = XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)parser->m_dataBufEnd); *eventEndPP = s; - defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); + parser->m_defaultHandler(parser->m_handlerArg, parser->m_dataBuf, + (int)(dataPtr - (ICHAR *)parser->m_dataBuf)); *eventPP = s; - } while ((convert_res != XML_CONVERT_COMPLETED) && (convert_res != XML_CONVERT_INPUT_INCOMPLETE)); - } - else - defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); + } while ((convert_res != XML_CONVERT_COMPLETED) + && (convert_res != XML_CONVERT_INPUT_INCOMPLETE)); + } else + parser->m_defaultHandler(parser->m_handlerArg, (XML_Char *)s, + (int)((XML_Char *)end - (XML_Char *)s)); } - static int defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, - XML_Bool isId, const XML_Char *value, XML_Parser parser) -{ + XML_Bool isId, const XML_Char *value, XML_Parser parser) { DEFAULT_ATTRIBUTE *att; if (value || isId) { /* The handling of default attributes gets messed up if we have @@ -5408,22 +6386,40 @@ defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, for (i = 0; i < type->nDefaultAtts; i++) if (attId == type->defaultAtts[i].id) return 1; - if (isId && !type->idAtt && !attId->xmlns) + if (isId && ! type->idAtt && ! attId->xmlns) type->idAtt = attId; } if (type->nDefaultAtts == type->allocDefaultAtts) { if (type->allocDefaultAtts == 0) { type->allocDefaultAtts = 8; - type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts - * sizeof(DEFAULT_ATTRIBUTE)); - if (!type->defaultAtts) + type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC( + parser, type->allocDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); + if (! type->defaultAtts) { + type->allocDefaultAtts = 0; return 0; - } - else { + } + } else { DEFAULT_ATTRIBUTE *temp; + + /* Detect and prevent integer overflow */ + if (type->allocDefaultAtts > INT_MAX / 2) { + return 0; + } + int count = type->allocDefaultAtts * 2; - temp = (DEFAULT_ATTRIBUTE *) - REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE))); + + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if ((unsigned)count > (size_t)(-1) / sizeof(DEFAULT_ATTRIBUTE)) { + return 0; + } +#endif + + temp = (DEFAULT_ATTRIBUTE *)REALLOC(parser, type->defaultAtts, + (count * sizeof(DEFAULT_ATTRIBUTE))); if (temp == NULL) return 0; type->allocDefaultAtts = count; @@ -5434,92 +6430,89 @@ defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, att->id = attId; att->value = value; att->isCdata = isCdata; - if (!isCdata) + if (! isCdata) attId->maybeTokenized = XML_TRUE; type->nDefaultAtts += 1; return 1; } static int -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ +setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ const XML_Char *name; for (name = elementType->name; *name; name++) { if (*name == XML_T(ASCII_COLON)) { PREFIX *prefix; const XML_Char *s; for (s = elementType->name; s != name; s++) { - if (!poolAppendChar(&dtd->pool, *s)) + if (! poolAppendChar(&dtd->pool, *s)) return 0; } - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) + if (! poolAppendChar(&dtd->pool, XML_T('\0'))) return 0; prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX)); - if (!prefix) + if (! prefix) return 0; if (prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); else poolDiscard(&dtd->pool); elementType->prefix = prefix; - + break; } } return 1; } static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ +getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, + const char *end) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ ATTRIBUTE_ID *id; const XML_Char *name; - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) + if (! poolAppendChar(&dtd->pool, XML_T('\0'))) return NULL; name = poolStoreString(&dtd->pool, enc, start, end); - if (!name) + if (! name) return NULL; /* skip quotation mark - its storage will be re-used (like in name[-1]) */ ++name; - id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, name, sizeof(ATTRIBUTE_ID)); - if (!id) + id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, name, + sizeof(ATTRIBUTE_ID)); + if (! id) return NULL; if (id->name != name) poolDiscard(&dtd->pool); else { poolFinish(&dtd->pool); - if (!ns) + if (! parser->m_ns) ; - else if (name[0] == XML_T(ASCII_x) - && name[1] == XML_T(ASCII_m) - && name[2] == XML_T(ASCII_l) - && name[3] == XML_T(ASCII_n) - && name[4] == XML_T(ASCII_s) - && (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) { + else if (name[0] == XML_T(ASCII_x) && name[1] == XML_T(ASCII_m) + && name[2] == XML_T(ASCII_l) && name[3] == XML_T(ASCII_n) + && name[4] == XML_T(ASCII_s) + && (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) { if (name[5] == XML_T('\0')) id->prefix = &dtd->defaultPrefix; else - id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, name + 6, sizeof(PREFIX)); + id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, name + 6, + sizeof(PREFIX)); id->xmlns = XML_TRUE; - } - else { + } else { int i; for (i = 0; name[i]; i++) { /* attributes without prefix are *not* in the default namespace */ if (name[i] == XML_T(ASCII_COLON)) { int j; for (j = 0; j < i; j++) { - if (!poolAppendChar(&dtd->pool, name[j])) + if (! poolAppendChar(&dtd->pool, name[j])) return NULL; } - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) + if (! poolAppendChar(&dtd->pool, XML_T('\0'))) return NULL; - id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), - sizeof(PREFIX)); - if (!id->prefix) + id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, + poolStart(&dtd->pool), sizeof(PREFIX)); + if (! id->prefix) return NULL; if (id->prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); @@ -5536,23 +6529,44 @@ getAttributeId(XML_Parser parser, const ENCODING *enc, #define CONTEXT_SEP XML_T(ASCII_FF) static const XML_Char * -getContext(XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ +getContext(XML_Parser parser) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ HASH_TABLE_ITER iter; XML_Bool needSep = XML_FALSE; if (dtd->defaultPrefix.binding) { int i; int len; - if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) + if (! poolAppendChar(&parser->m_tempPool, XML_T(ASCII_EQUALS))) return NULL; len = dtd->defaultPrefix.binding->uriLen; - if (namespaceSeparator) + if (parser->m_namespaceSeparator) len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i])) - return NULL; + for (i = 0; i < len; i++) { + if (! poolAppendChar(&parser->m_tempPool, + dtd->defaultPrefix.binding->uri[i])) { + /* Because of memory caching, I don't believe this line can be + * executed. + * + * This is part of a loop copying the default prefix binding + * URI into the parser's temporary string pool. Previously, + * that URI was copied into the same string pool, with a + * terminating NUL character, as part of setContext(). When + * the pool was cleared, that leaves a block definitely big + * enough to hold the URI on the free block list of the pool. + * The URI copy in getContext() therefore cannot run out of + * memory. + * + * If the pool is used between the setContext() and + * getContext() calls, the worst it can do is leave a bigger + * block on the front of the free list. Given that this is + * all somewhat inobvious and program logic can be changed, we + * don't delete the line but we do exclude it from the test + * coverage statistics. + */ + return NULL; /* LCOV_EXCL_LINE */ + } + } needSep = XML_TRUE; } @@ -5562,102 +6576,107 @@ getContext(XML_Parser parser) int len; const XML_Char *s; PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); - if (!prefix) + if (! prefix) break; - if (!prefix->binding) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) + if (! prefix->binding) { + /* This test appears to be (justifiable) paranoia. There does + * not seem to be a way of injecting a prefix without a binding + * that doesn't get errored long before this function is called. + * The test should remain for safety's sake, so we instead + * exclude the following line from the coverage statistics. + */ + continue; /* LCOV_EXCL_LINE */ + } + if (needSep && ! poolAppendChar(&parser->m_tempPool, CONTEXT_SEP)) return NULL; for (s = prefix->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) + if (! poolAppendChar(&parser->m_tempPool, *s)) return NULL; - if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) + if (! poolAppendChar(&parser->m_tempPool, XML_T(ASCII_EQUALS))) return NULL; len = prefix->binding->uriLen; - if (namespaceSeparator) + if (parser->m_namespaceSeparator) len--; for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) + if (! poolAppendChar(&parser->m_tempPool, prefix->binding->uri[i])) return NULL; needSep = XML_TRUE; } - hashTableIterInit(&iter, &(dtd->generalEntities)); for (;;) { const XML_Char *s; ENTITY *e = (ENTITY *)hashTableIterNext(&iter); - if (!e) + if (! e) break; - if (!e->open) + if (! e->open) continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) + if (needSep && ! poolAppendChar(&parser->m_tempPool, CONTEXT_SEP)) return NULL; for (s = e->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) + if (! poolAppendChar(&parser->m_tempPool, *s)) return 0; needSep = XML_TRUE; } - if (!poolAppendChar(&tempPool, XML_T('\0'))) + if (! poolAppendChar(&parser->m_tempPool, XML_T('\0'))) return NULL; - return tempPool.start; + return parser->m_tempPool.start; } static XML_Bool -setContext(XML_Parser parser, const XML_Char *context) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ +setContext(XML_Parser parser, const XML_Char *context) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ const XML_Char *s = context; while (*context != XML_T('\0')) { if (*s == CONTEXT_SEP || *s == XML_T('\0')) { ENTITY *e; - if (!poolAppendChar(&tempPool, XML_T('\0'))) + if (! poolAppendChar(&parser->m_tempPool, XML_T('\0'))) return XML_FALSE; - e = (ENTITY *)lookup(parser, &dtd->generalEntities, poolStart(&tempPool), 0); + e = (ENTITY *)lookup(parser, &dtd->generalEntities, + poolStart(&parser->m_tempPool), 0); if (e) e->open = XML_TRUE; if (*s != XML_T('\0')) s++; context = s; - poolDiscard(&tempPool); - } - else if (*s == XML_T(ASCII_EQUALS)) { + poolDiscard(&parser->m_tempPool); + } else if (*s == XML_T(ASCII_EQUALS)) { PREFIX *prefix; - if (poolLength(&tempPool) == 0) + if (poolLength(&parser->m_tempPool) == 0) prefix = &dtd->defaultPrefix; else { - if (!poolAppendChar(&tempPool, XML_T('\0'))) + if (! poolAppendChar(&parser->m_tempPool, XML_T('\0'))) return XML_FALSE; - prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&tempPool), - sizeof(PREFIX)); - if (!prefix) + prefix + = (PREFIX *)lookup(parser, &dtd->prefixes, + poolStart(&parser->m_tempPool), sizeof(PREFIX)); + if (! prefix) return XML_FALSE; - if (prefix->name == poolStart(&tempPool)) { + if (prefix->name == poolStart(&parser->m_tempPool)) { prefix->name = poolCopyString(&dtd->pool, prefix->name); - if (!prefix->name) + if (! prefix->name) return XML_FALSE; } - poolDiscard(&tempPool); + poolDiscard(&parser->m_tempPool); } - for (context = s + 1; - *context != CONTEXT_SEP && *context != XML_T('\0'); + for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\0'); context++) - if (!poolAppendChar(&tempPool, *context)) + if (! poolAppendChar(&parser->m_tempPool, *context)) return XML_FALSE; - if (!poolAppendChar(&tempPool, XML_T('\0'))) + if (! poolAppendChar(&parser->m_tempPool, XML_T('\0'))) return XML_FALSE; - if (addBinding(parser, prefix, NULL, poolStart(&tempPool), - &inheritedBindings) != XML_ERROR_NONE) + if (addBinding(parser, prefix, NULL, poolStart(&parser->m_tempPool), + &parser->m_inheritedBindings) + != XML_ERROR_NONE) return XML_FALSE; - poolDiscard(&tempPool); + poolDiscard(&parser->m_tempPool); if (*context != XML_T('\0')) ++context; s = context; - } - else { - if (!poolAppendChar(&tempPool, *s)) + } else { + if (! poolAppendChar(&parser->m_tempPool, *s)) return XML_FALSE; s++; } @@ -5666,8 +6685,7 @@ setContext(XML_Parser parser, const XML_Char *context) } static void FASTCALL -normalizePublicId(XML_Char *publicId) -{ +normalizePublicId(XML_Char *publicId) { XML_Char *p = publicId; XML_Char *s; for (s = publicId; *s; s++) { @@ -5688,9 +6706,8 @@ normalizePublicId(XML_Char *publicId) } static DTD * -dtdCreate(const XML_Memory_Handling_Suite *ms) -{ - DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD)); +dtdCreate(const XML_Memory_Handling_Suite *ms) { + DTD *p = ms->malloc_fcn(sizeof(DTD)); if (p == NULL) return p; poolInit(&(p->pool), ms); @@ -5721,13 +6738,12 @@ dtdCreate(const XML_Memory_Handling_Suite *ms) } static void -dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) -{ +dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) { HASH_TABLE_ITER iter; hashTableIterInit(&iter, &(p->elementTypes)); for (;;) { ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) + if (! e) break; if (e->allocDefaultAtts != 0) ms->free_fcn(e->defaultAtts); @@ -5763,13 +6779,12 @@ dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) } static void -dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) -{ +dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) { HASH_TABLE_ITER iter; hashTableIterInit(&iter, &(p->elementTypes)); for (;;) { ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) + if (! e) break; if (e->allocDefaultAtts != 0) ms->free_fcn(e->defaultAtts); @@ -5794,8 +6809,8 @@ dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) The new DTD has already been initialized. */ static int -dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms) -{ +dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, + const XML_Memory_Handling_Suite *ms) { HASH_TABLE_ITER iter; /* Copy the prefix table. */ @@ -5804,12 +6819,12 @@ dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_H for (;;) { const XML_Char *name; const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); - if (!oldP) + if (! oldP) break; name = poolCopyString(&(newDtd->pool), oldP->name); - if (!name) + if (! name) return 0; - if (!lookup(oldParser, &(newDtd->prefixes), name, sizeof(PREFIX))) + if (! lookup(oldParser, &(newDtd->prefixes), name, sizeof(PREFIX))) return 0; } @@ -5822,18 +6837,18 @@ dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_H const XML_Char *name; const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); - if (!oldA) + if (! oldA) break; /* Remember to allocate the scratch byte before the name. */ - if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) + if (! poolAppendChar(&(newDtd->pool), XML_T('\0'))) return 0; name = poolCopyString(&(newDtd->pool), oldA->name); - if (!name) + if (! name) return 0; ++name; newA = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID)); - if (!newA) + if (! newA) return 0; newA->maybeTokenized = oldA->maybeTokenized; if (oldA->prefix) { @@ -5855,58 +6870,52 @@ dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_H ELEMENT_TYPE *newE; const XML_Char *name; const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!oldE) + if (! oldE) break; name = poolCopyString(&(newDtd->pool), oldE->name); - if (!name) + if (! name) return 0; newE = (ELEMENT_TYPE *)lookup(oldParser, &(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE)); - if (!newE) + if (! newE) return 0; if (oldE->nDefaultAtts) { - newE->defaultAtts = (DEFAULT_ATTRIBUTE *) - ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); - if (!newE->defaultAtts) { - ms->free_fcn(newE); + newE->defaultAtts + = ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); + if (! newE->defaultAtts) { return 0; } } if (oldE->idAtt) - newE->idAtt = (ATTRIBUTE_ID *) - lookup(oldParser, &(newDtd->attributeIds), oldE->idAtt->name, 0); + newE->idAtt = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds), + oldE->idAtt->name, 0); newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; if (oldE->prefix) newE->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), oldE->prefix->name, 0); for (i = 0; i < newE->nDefaultAtts; i++) { - newE->defaultAtts[i].id = (ATTRIBUTE_ID *) - lookup(oldParser, &(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); + newE->defaultAtts[i].id = (ATTRIBUTE_ID *)lookup( + oldParser, &(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; if (oldE->defaultAtts[i].value) { newE->defaultAtts[i].value = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); - if (!newE->defaultAtts[i].value) + if (! newE->defaultAtts[i].value) return 0; - } - else + } else newE->defaultAtts[i].value = NULL; } } /* Copy the entity tables. */ - if (!copyEntityTable(oldParser, - &(newDtd->generalEntities), - &(newDtd->pool), - &(oldDtd->generalEntities))) - return 0; + if (! copyEntityTable(oldParser, &(newDtd->generalEntities), &(newDtd->pool), + &(oldDtd->generalEntities))) + return 0; #ifdef XML_DTD - if (!copyEntityTable(oldParser, - &(newDtd->paramEntities), - &(newDtd->pool), - &(oldDtd->paramEntities))) - return 0; + if (! copyEntityTable(oldParser, &(newDtd->paramEntities), &(newDtd->pool), + &(oldDtd->paramEntities))) + return 0; newDtd->paramEntityRead = oldDtd->paramEntityRead; #endif /* XML_DTD */ @@ -5923,14 +6932,11 @@ dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_H newDtd->scaffIndex = oldDtd->scaffIndex; return 1; -} /* End dtdCopy */ +} /* End dtdCopy */ static int -copyEntityTable(XML_Parser oldParser, - HASH_TABLE *newTable, - STRING_POOL *newPool, - const HASH_TABLE *oldTable) -{ +copyEntityTable(XML_Parser oldParser, HASH_TABLE *newTable, + STRING_POOL *newPool, const HASH_TABLE *oldTable) { HASH_TABLE_ITER iter; const XML_Char *cachedOldBase = NULL; const XML_Char *cachedNewBase = NULL; @@ -5941,17 +6947,17 @@ copyEntityTable(XML_Parser oldParser, ENTITY *newE; const XML_Char *name; const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); - if (!oldE) + if (! oldE) break; name = poolCopyString(newPool, oldE->name); - if (!name) + if (! name) return 0; newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY)); - if (!newE) + if (! newE) return 0; if (oldE->systemId) { const XML_Char *tem = poolCopyString(newPool, oldE->systemId); - if (!tem) + if (! tem) return 0; newE->systemId = tem; if (oldE->base) { @@ -5960,29 +6966,28 @@ copyEntityTable(XML_Parser oldParser, else { cachedOldBase = oldE->base; tem = poolCopyString(newPool, cachedOldBase); - if (!tem) + if (! tem) return 0; cachedNewBase = newE->base = tem; } } if (oldE->publicId) { tem = poolCopyString(newPool, oldE->publicId); - if (!tem) + if (! tem) return 0; newE->publicId = tem; } - } - else { - const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, - oldE->textLen); - if (!tem) + } else { + const XML_Char *tem + = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen); + if (! tem) return 0; newE->textPtr = tem; newE->textLen = oldE->textLen; } if (oldE->notation) { const XML_Char *tem = poolCopyString(newPool, oldE->notation); - if (!tem) + if (! tem) return 0; newE->notation = tem; } @@ -5995,44 +7000,57 @@ copyEntityTable(XML_Parser oldParser, #define INIT_POWER 6 static XML_Bool FASTCALL -keyeq(KEY s1, KEY s2) -{ +keyeq(KEY s1, KEY s2) { for (; *s1 == *s2; s1++, s2++) if (*s1 == 0) return XML_TRUE; return XML_FALSE; } +static size_t +keylen(KEY s) { + size_t len = 0; + for (; *s; s++, len++) + ; + return len; +} + +static void +copy_salt_to_sipkey(XML_Parser parser, struct sipkey *key) { + key->k[0] = 0; + key->k[1] = get_hash_secret_salt(parser); +} + static unsigned long FASTCALL -hash(XML_Parser parser, KEY s) -{ - unsigned long h = hash_secret_salt; - while (*s) - h = CHAR_HASH(h, *s++); - return h; +hash(XML_Parser parser, KEY s) { + struct siphash state; + struct sipkey key; + (void)sip24_valid; + copy_salt_to_sipkey(parser, &key); + sip24_init(&state, &key); + sip24_update(&state, s, keylen(s) * sizeof(XML_Char)); + return (unsigned long)sip24_final(&state); } static NAMED * -lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) -{ +lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) { size_t i; if (table->size == 0) { size_t tsize; - if (!createSize) + if (! createSize) return NULL; table->power = INIT_POWER; /* table->size is a power of 2 */ table->size = (size_t)1 << INIT_POWER; tsize = table->size * sizeof(NAMED *); - table->v = (NAMED **)table->mem->malloc_fcn(tsize); - if (!table->v) { + table->v = table->mem->malloc_fcn(tsize); + if (! table->v) { table->size = 0; return NULL; } memset(table->v, 0, tsize); i = hash(parser, name) & ((unsigned long)table->size - 1); - } - else { + } else { unsigned long h = hash(parser, name); unsigned long mask = (unsigned long)table->size - 1; unsigned char step = 0; @@ -6040,21 +7058,33 @@ lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) while (table->v[i]) { if (keyeq(name, table->v[i]->name)) return table->v[i]; - if (!step) + if (! step) step = PROBE_STEP(h, mask, table->power); i < step ? (i += table->size - step) : (i -= step); } - if (!createSize) + if (! createSize) return NULL; /* check for overflow (table is half full) */ if (table->used >> (table->power - 1)) { unsigned char newPower = table->power + 1; + + /* Detect and prevent invalid shift */ + if (newPower >= sizeof(unsigned long) * 8 /* bits per byte */) { + return NULL; + } + size_t newSize = (size_t)1 << newPower; unsigned long newMask = (unsigned long)newSize - 1; + + /* Detect and prevent integer overflow */ + if (newSize > (size_t)(-1) / sizeof(NAMED *)) { + return NULL; + } + size_t tsize = newSize * sizeof(NAMED *); - NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize); - if (!newV) + NAMED **newV = table->mem->malloc_fcn(tsize); + if (! newV) return NULL; memset(newV, 0, tsize); for (i = 0; i < table->size; i++) @@ -6063,7 +7093,7 @@ lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) size_t j = newHash & newMask; step = 0; while (newV[j]) { - if (!step) + if (! step) step = PROBE_STEP(newHash, newMask, newPower); j < step ? (j += newSize - step) : (j -= step); } @@ -6076,14 +7106,14 @@ lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) i = h & newMask; step = 0; while (table->v[i]) { - if (!step) + if (! step) step = PROBE_STEP(h, newMask, newPower); i < step ? (i += newSize - step) : (i -= step); } } } - table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize); - if (!table->v[i]) + table->v[i] = table->mem->malloc_fcn(createSize); + if (! table->v[i]) return NULL; memset(table->v[i], 0, createSize); table->v[i]->name = name; @@ -6092,8 +7122,7 @@ lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) } static void FASTCALL -hashTableClear(HASH_TABLE *table) -{ +hashTableClear(HASH_TABLE *table) { size_t i; for (i = 0; i < table->size; i++) { table->mem->free_fcn(table->v[i]); @@ -6103,8 +7132,7 @@ hashTableClear(HASH_TABLE *table) } static void FASTCALL -hashTableDestroy(HASH_TABLE *table) -{ +hashTableDestroy(HASH_TABLE *table) { size_t i; for (i = 0; i < table->size; i++) table->mem->free_fcn(table->v[i]); @@ -6112,8 +7140,7 @@ hashTableDestroy(HASH_TABLE *table) } static void FASTCALL -hashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms) -{ +hashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms) { p->power = 0; p->size = 0; p->used = 0; @@ -6122,15 +7149,13 @@ hashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms) } static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) -{ +hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) { iter->p = table->v; - iter->end = iter->p + table->size; + iter->end = iter->p ? iter->p + table->size : NULL; } -static NAMED * FASTCALL -hashTableIterNext(HASH_TABLE_ITER *iter) -{ +static NAMED *FASTCALL +hashTableIterNext(HASH_TABLE_ITER *iter) { while (iter->p != iter->end) { NAMED *tem = *(iter->p)++; if (tem) @@ -6140,8 +7165,7 @@ hashTableIterNext(HASH_TABLE_ITER *iter) } static void FASTCALL -poolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms) -{ +poolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms) { pool->blocks = NULL; pool->freeBlocks = NULL; pool->start = NULL; @@ -6151,9 +7175,8 @@ poolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms) } static void FASTCALL -poolClear(STRING_POOL *pool) -{ - if (!pool->freeBlocks) +poolClear(STRING_POOL *pool) { + if (! pool->freeBlocks) pool->freeBlocks = pool->blocks; else { BLOCK *p = pool->blocks; @@ -6171,8 +7194,7 @@ poolClear(STRING_POOL *pool) } static void FASTCALL -poolDestroy(STRING_POOL *pool) -{ +poolDestroy(STRING_POOL *pool) { BLOCK *p = pool->blocks; while (p) { BLOCK *tem = p->next; @@ -6188,26 +7210,26 @@ poolDestroy(STRING_POOL *pool) } static XML_Char * -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!pool->ptr && !poolGrow(pool)) +poolAppend(STRING_POOL *pool, const ENCODING *enc, const char *ptr, + const char *end) { + if (! pool->ptr && ! poolGrow(pool)) return NULL; for (;;) { - const enum XML_Convert_Result convert_res = XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); - if ((convert_res == XML_CONVERT_COMPLETED) || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) + const enum XML_Convert_Result convert_res = XmlConvert( + enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); + if ((convert_res == XML_CONVERT_COMPLETED) + || (convert_res == XML_CONVERT_INPUT_INCOMPLETE)) break; - if (!poolGrow(pool)) + if (! poolGrow(pool)) return NULL; } return pool->start; } -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s) -{ +static const XML_Char *FASTCALL +poolCopyString(STRING_POOL *pool, const XML_Char *s) { do { - if (!poolAppendChar(pool, *s)) + if (! poolAppendChar(pool, *s)) return NULL; } while (*s++); s = pool->start; @@ -6216,12 +7238,23 @@ poolCopyString(STRING_POOL *pool, const XML_Char *s) } static const XML_Char * -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; +poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) { + if (! pool->ptr && ! poolGrow(pool)) { + /* The following line is unreachable given the current usage of + * poolCopyStringN(). Currently it is called from exactly one + * place to copy the text of a simple general entity. By that + * point, the name of the entity is already stored in the pool, so + * pool->ptr cannot be NULL. + * + * If poolCopyStringN() is used elsewhere as it well might be, + * this line may well become executable again. Regardless, this + * sort of check shouldn't be removed lightly, so we just exclude + * it from the coverage statistics. + */ + return NULL; /* LCOV_EXCL_LINE */ + } for (; n > 0; --n, s++) { - if (!poolAppendChar(pool, *s)) + if (! poolAppendChar(pool, *s)) return NULL; } s = pool->start; @@ -6229,11 +7262,10 @@ poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) return s; } -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s) -{ +static const XML_Char *FASTCALL +poolAppendString(STRING_POOL *pool, const XML_Char *s) { while (*s) { - if (!poolAppendChar(pool, *s)) + if (! poolAppendChar(pool, *s)) return NULL; s++; } @@ -6241,20 +7273,46 @@ poolAppendString(STRING_POOL *pool, const XML_Char *s) } static XML_Char * -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!poolAppend(pool, enc, ptr, end)) +poolStoreString(STRING_POOL *pool, const ENCODING *enc, const char *ptr, + const char *end) { + if (! poolAppend(pool, enc, ptr, end)) return NULL; - if (pool->ptr == pool->end && !poolGrow(pool)) + if (pool->ptr == pool->end && ! poolGrow(pool)) return NULL; *(pool->ptr)++ = 0; return pool->start; } +static size_t +poolBytesToAllocateFor(int blockSize) { + /* Unprotected math would be: + ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char); + ** + ** Detect overflow, avoiding _signed_ overflow undefined behavior + ** For a + b * c we check b * c in isolation first, so that addition of a + ** on top has no chance of making us accept a small non-negative number + */ + const size_t stretch = sizeof(XML_Char); /* can be 4 bytes */ + + if (blockSize <= 0) + return 0; + + if (blockSize > (int)(INT_MAX / stretch)) + return 0; + + { + const int stretchedBlockSize = blockSize * (int)stretch; + const int bytesToAllocate + = (int)(offsetof(BLOCK, s) + (unsigned)stretchedBlockSize); + if (bytesToAllocate < 0) + return 0; + + return (size_t)bytesToAllocate; + } +} + static XML_Bool FASTCALL -poolGrow(STRING_POOL *pool) -{ +poolGrow(STRING_POOL *pool) { if (pool->freeBlocks) { if (pool->start == 0) { pool->blocks = pool->freeBlocks; @@ -6280,44 +7338,76 @@ poolGrow(STRING_POOL *pool) } if (pool->blocks && pool->start == pool->blocks->s) { BLOCK *temp; - int blockSize = (int)((unsigned)(pool->end - pool->start)*2U); + int blockSize = (int)((unsigned)(pool->end - pool->start) * 2U); + size_t bytesToAllocate; - if (blockSize < 0) + /* NOTE: Needs to be calculated prior to calling `realloc` + to avoid dangling pointers: */ + const ptrdiff_t offsetInsideBlock = pool->ptr - pool->start; + + if (blockSize < 0) { + /* This condition traps a situation where either more than + * INT_MAX/2 bytes have already been allocated. This isn't + * readily testable, since it is unlikely that an average + * machine will have that much memory, so we exclude it from the + * coverage statistics. + */ + return XML_FALSE; /* LCOV_EXCL_LINE */ + } + + bytesToAllocate = poolBytesToAllocateFor(blockSize); + if (bytesToAllocate == 0) return XML_FALSE; - temp = (BLOCK *) - pool->mem->realloc_fcn(pool->blocks, - (offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char))); + temp = (BLOCK *)pool->mem->realloc_fcn(pool->blocks, + (unsigned)bytesToAllocate); if (temp == NULL) return XML_FALSE; pool->blocks = temp; pool->blocks->size = blockSize; - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); + pool->ptr = pool->blocks->s + offsetInsideBlock; pool->start = pool->blocks->s; pool->end = pool->start + blockSize; - } - else { + } else { BLOCK *tem; int blockSize = (int)(pool->end - pool->start); + size_t bytesToAllocate; - if (blockSize < 0) - return XML_FALSE; + if (blockSize < 0) { + /* This condition traps a situation where either more than + * INT_MAX bytes have already been allocated (which is prevented + * by various pieces of program logic, not least this one, never + * mind the unlikelihood of actually having that much memory) or + * the pool control fields have been corrupted (which could + * conceivably happen in an extremely buggy user handler + * function). Either way it isn't readily testable, so we + * exclude it from the coverage statistics. + */ + return XML_FALSE; /* LCOV_EXCL_LINE */ + } if (blockSize < INIT_BLOCK_SIZE) blockSize = INIT_BLOCK_SIZE; - else + else { + /* Detect overflow, avoiding _signed_ overflow undefined behavior */ + if ((int)((unsigned)blockSize * 2U) < 0) { + return XML_FALSE; + } blockSize *= 2; - tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char)); - if (!tem) + } + + bytesToAllocate = poolBytesToAllocateFor(blockSize); + if (bytesToAllocate == 0) + return XML_FALSE; + + tem = pool->mem->malloc_fcn(bytesToAllocate); + if (! tem) return XML_FALSE; tem->size = blockSize; tem->next = pool->blocks; pool->blocks = tem; if (pool->ptr != pool->start) - memcpy(tem->s, pool->start, - (pool->ptr - pool->start) * sizeof(XML_Char)); + memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char)); pool->ptr = tem->s + (pool->ptr - pool->start); pool->start = tem->s; pool->end = tem->s + blockSize; @@ -6326,15 +7416,14 @@ poolGrow(STRING_POOL *pool) } static int FASTCALL -nextScaffoldPart(XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - CONTENT_SCAFFOLD * me; +nextScaffoldPart(XML_Parser parser) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ + CONTENT_SCAFFOLD *me; int next; - if (!dtd->scaffIndex) { - dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int)); - if (!dtd->scaffIndex) + if (! dtd->scaffIndex) { + dtd->scaffIndex = (int *)MALLOC(parser, parser->m_groupSize * sizeof(int)); + if (! dtd->scaffIndex) return -1; dtd->scaffIndex[0] = 0; } @@ -6342,15 +7431,28 @@ nextScaffoldPart(XML_Parser parser) if (dtd->scaffCount >= dtd->scaffSize) { CONTENT_SCAFFOLD *temp; if (dtd->scaffold) { - temp = (CONTENT_SCAFFOLD *) - REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD)); + /* Detect and prevent integer overflow */ + if (dtd->scaffSize > UINT_MAX / 2u) { + return -1; + } + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if (dtd->scaffSize > (size_t)(-1) / 2u / sizeof(CONTENT_SCAFFOLD)) { + return -1; + } +#endif + + temp = (CONTENT_SCAFFOLD *)REALLOC( + parser, dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD)); if (temp == NULL) return -1; dtd->scaffSize *= 2; - } - else { - temp = (CONTENT_SCAFFOLD *)MALLOC(INIT_SCAFFOLD_ELEMENTS - * sizeof(CONTENT_SCAFFOLD)); + } else { + temp = (CONTENT_SCAFFOLD *)MALLOC(parser, INIT_SCAFFOLD_ELEMENTS + * sizeof(CONTENT_SCAFFOLD)); if (temp == NULL) return -1; dtd->scaffSize = INIT_SCAFFOLD_ELEMENTS; @@ -6360,11 +7462,12 @@ nextScaffoldPart(XML_Parser parser) next = dtd->scaffCount++; me = &dtd->scaffold[next]; if (dtd->scaffLevel) { - CONTENT_SCAFFOLD *parent = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel-1]]; + CONTENT_SCAFFOLD *parent + = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]]; if (parent->lastchild) { dtd->scaffold[parent->lastchild].nextsib = next; } - if (!parent->childcnt) + if (! parent->childcnt) parent->firstchild = next; parent->lastchild = next; parent->childcnt++; @@ -6373,86 +7476,925 @@ nextScaffoldPart(XML_Parser parser) return next; } -static void -build_node(XML_Parser parser, - int src_node, - XML_Content *dest, - XML_Content **contpos, - XML_Char **strpos) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - dest->type = dtd->scaffold[src_node].type; - dest->quant = dtd->scaffold[src_node].quant; - if (dest->type == XML_CTYPE_NAME) { - const XML_Char *src; - dest->name = *strpos; - src = dtd->scaffold[src_node].name; - for (;;) { - *(*strpos)++ = *src; - if (!*src) - break; - src++; - } - dest->numchildren = 0; - dest->children = NULL; - } - else { - unsigned int i; - int cn; - dest->numchildren = dtd->scaffold[src_node].childcnt; - dest->children = *contpos; - *contpos += dest->numchildren; - for (i = 0, cn = dtd->scaffold[src_node].firstchild; - i < dest->numchildren; - i++, cn = dtd->scaffold[cn].nextsib) { - build_node(parser, cn, &(dest->children[i]), contpos, strpos); - } - dest->name = NULL; - } -} - static XML_Content * -build_model (XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ +build_model(XML_Parser parser) { + /* Function build_model transforms the existing parser->m_dtd->scaffold + * array of CONTENT_SCAFFOLD tree nodes into a new array of + * XML_Content tree nodes followed by a gapless list of zero-terminated + * strings. */ + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ XML_Content *ret; - XML_Content *cpos; - XML_Char * str; - int allocsize = (dtd->scaffCount * sizeof(XML_Content) - + (dtd->contentStringLen * sizeof(XML_Char))); + XML_Char *str; /* the current string writing location */ - ret = (XML_Content *)MALLOC(allocsize); - if (!ret) + /* Detect and prevent integer overflow. + * The preprocessor guard addresses the "always false" warning + * from -Wtype-limits on platforms where + * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ +#if UINT_MAX >= SIZE_MAX + if (dtd->scaffCount > (size_t)(-1) / sizeof(XML_Content)) { + return NULL; + } + if (dtd->contentStringLen > (size_t)(-1) / sizeof(XML_Char)) { + return NULL; + } +#endif + if (dtd->scaffCount * sizeof(XML_Content) + > (size_t)(-1) - dtd->contentStringLen * sizeof(XML_Char)) { + return NULL; + } + + const size_t allocsize = (dtd->scaffCount * sizeof(XML_Content) + + (dtd->contentStringLen * sizeof(XML_Char))); + + ret = (XML_Content *)MALLOC(parser, allocsize); + if (! ret) return NULL; - str = (XML_Char *) (&ret[dtd->scaffCount]); - cpos = &ret[1]; + /* What follows is an iterative implementation (of what was previously done + * recursively in a dedicated function called "build_node". The old recursive + * build_node could be forced into stack exhaustion from input as small as a + * few megabyte, and so that was a security issue. Hence, a function call + * stack is avoided now by resolving recursion.) + * + * The iterative approach works as follows: + * + * - We have two writing pointers, both walking up the result array; one does + * the work, the other creates "jobs" for its colleague to do, and leads + * the way: + * + * - The faster one, pointer jobDest, always leads and writes "what job + * to do" by the other, once they reach that place in the + * array: leader "jobDest" stores the source node array index (relative + * to array dtd->scaffold) in field "numchildren". + * + * - The slower one, pointer dest, looks at the value stored in the + * "numchildren" field (which actually holds a source node array index + * at that time) and puts the real data from dtd->scaffold in. + * + * - Before the loop starts, jobDest writes source array index 0 + * (where the root node is located) so that dest will have something to do + * when it starts operation. + * + * - Whenever nodes with children are encountered, jobDest appends + * them as new jobs, in order. As a result, tree node siblings are + * adjacent in the resulting array, for example: + * + * [0] root, has two children + * [1] first child of 0, has three children + * [3] first child of 1, does not have children + * [4] second child of 1, does not have children + * [5] third child of 1, does not have children + * [2] second child of 0, does not have children + * + * Or (the same data) presented in flat array view: + * + * [0] root, has two children + * + * [1] first child of 0, has three children + * [2] second child of 0, does not have children + * + * [3] first child of 1, does not have children + * [4] second child of 1, does not have children + * [5] third child of 1, does not have children + * + * - The algorithm repeats until all target array indices have been processed. + */ + XML_Content *dest = ret; /* tree node writing location, moves upwards */ + XML_Content *const destLimit = &ret[dtd->scaffCount]; + XML_Content *jobDest = ret; /* next free writing location in target array */ + str = (XML_Char *)&ret[dtd->scaffCount]; + + /* Add the starting job, the root node (index 0) of the source tree */ + (jobDest++)->numchildren = 0; + + for (; dest < destLimit; dest++) { + /* Retrieve source tree array index from job storage */ + const int src_node = (int)dest->numchildren; + + /* Convert item */ + dest->type = dtd->scaffold[src_node].type; + dest->quant = dtd->scaffold[src_node].quant; + if (dest->type == XML_CTYPE_NAME) { + const XML_Char *src; + dest->name = str; + src = dtd->scaffold[src_node].name; + for (;;) { + *str++ = *src; + if (! *src) + break; + src++; + } + dest->numchildren = 0; + dest->children = NULL; + } else { + unsigned int i; + int cn; + dest->name = NULL; + dest->numchildren = dtd->scaffold[src_node].childcnt; + dest->children = jobDest; + + /* Append scaffold indices of children to array */ + for (i = 0, cn = dtd->scaffold[src_node].firstchild; + i < dest->numchildren; i++, cn = dtd->scaffold[cn].nextsib) + (jobDest++)->numchildren = (unsigned int)cn; + } + } - build_node(parser, 0, ret, &cpos, &str); return ret; } static ELEMENT_TYPE * -getElementType(XML_Parser parser, - const ENCODING *enc, - const char *ptr, - const char *end) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ +getElementType(XML_Parser parser, const ENCODING *enc, const char *ptr, + const char *end) { + DTD *const dtd = parser->m_dtd; /* save one level of indirection */ const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end); ELEMENT_TYPE *ret; - if (!name) + if (! name) return NULL; - ret = (ELEMENT_TYPE *) lookup(parser, &dtd->elementTypes, name, sizeof(ELEMENT_TYPE)); - if (!ret) + ret = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name, + sizeof(ELEMENT_TYPE)); + if (! ret) return NULL; if (ret->name != name) poolDiscard(&dtd->pool); else { poolFinish(&dtd->pool); - if (!setElementTypePrefix(parser, ret)) + if (! setElementTypePrefix(parser, ret)) return NULL; } return ret; } + +static XML_Char * +copyString(const XML_Char *s, const XML_Memory_Handling_Suite *memsuite) { + size_t charsRequired = 0; + XML_Char *result; + + /* First determine how long the string is */ + while (s[charsRequired] != 0) { + charsRequired++; + } + /* Include the terminator */ + charsRequired++; + + /* Now allocate space for the copy */ + result = memsuite->malloc_fcn(charsRequired * sizeof(XML_Char)); + if (result == NULL) + return NULL; + /* Copy the original into place */ + memcpy(result, s, charsRequired * sizeof(XML_Char)); + return result; +} + +#ifdef XML_DTD + +static float +accountingGetCurrentAmplification(XML_Parser rootParser) { + const XmlBigCount countBytesOutput + = rootParser->m_accounting.countBytesDirect + + rootParser->m_accounting.countBytesIndirect; + const float amplificationFactor + = rootParser->m_accounting.countBytesDirect + ? (countBytesOutput + / (float)(rootParser->m_accounting.countBytesDirect)) + : 1.0f; + assert(! rootParser->m_parentParser); + return amplificationFactor; +} + +static void +accountingReportStats(XML_Parser originParser, const char *epilog) { + const XML_Parser rootParser = getRootParserOf(originParser, NULL); + assert(! rootParser->m_parentParser); + + if (rootParser->m_accounting.debugLevel < 1) { + return; + } + + const float amplificationFactor + = accountingGetCurrentAmplification(rootParser); + fprintf(stderr, + "expat: Accounting(%p): Direct " EXPAT_FMT_ULL( + "10") ", indirect " EXPAT_FMT_ULL("10") ", amplification %8.2f%s", + (void *)rootParser, rootParser->m_accounting.countBytesDirect, + rootParser->m_accounting.countBytesIndirect, + (double)amplificationFactor, epilog); +} + +static void +accountingOnAbort(XML_Parser originParser) { + accountingReportStats(originParser, " ABORTING\n"); +} + +static void +accountingReportDiff(XML_Parser rootParser, + unsigned int levelsAwayFromRootParser, const char *before, + const char *after, ptrdiff_t bytesMore, int source_line, + enum XML_Account account) { + assert(! rootParser->m_parentParser); + + fprintf(stderr, + " (+" EXPAT_FMT_PTRDIFF_T("6") " bytes %s|%d, xmlparse.c:%d) %*s\"", + bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP", + levelsAwayFromRootParser, source_line, 10, ""); + + const char ellipis[] = "[..]"; + const size_t ellipsisLength = sizeof(ellipis) /* because compile-time */ - 1; + const unsigned int contextLength = 10; + + /* Note: Performance is of no concern here */ + const char *walker = before; + if ((rootParser->m_accounting.debugLevel >= 3) + || (after - before) + <= (ptrdiff_t)(contextLength + ellipsisLength + contextLength)) { + for (; walker < after; walker++) { + fprintf(stderr, "%s", unsignedCharToPrintable(walker[0])); + } + } else { + for (; walker < before + contextLength; walker++) { + fprintf(stderr, "%s", unsignedCharToPrintable(walker[0])); + } + fprintf(stderr, ellipis); + walker = after - contextLength; + for (; walker < after; walker++) { + fprintf(stderr, "%s", unsignedCharToPrintable(walker[0])); + } + } + fprintf(stderr, "\"\n"); +} + +static XML_Bool +accountingDiffTolerated(XML_Parser originParser, int tok, const char *before, + const char *after, int source_line, + enum XML_Account account) { + /* Note: We need to check the token type *first* to be sure that + * we can even access variable , safely. + * E.g. for XML_TOK_NONE may hold an invalid pointer. */ + switch (tok) { + case XML_TOK_INVALID: + case XML_TOK_PARTIAL: + case XML_TOK_PARTIAL_CHAR: + case XML_TOK_NONE: + return XML_TRUE; + } + + if (account == XML_ACCOUNT_NONE) + return XML_TRUE; /* because these bytes have been accounted for, already */ + + unsigned int levelsAwayFromRootParser; + const XML_Parser rootParser + = getRootParserOf(originParser, &levelsAwayFromRootParser); + assert(! rootParser->m_parentParser); + + const int isDirect + = (account == XML_ACCOUNT_DIRECT) && (originParser == rootParser); + const ptrdiff_t bytesMore = after - before; + + XmlBigCount *const additionTarget + = isDirect ? &rootParser->m_accounting.countBytesDirect + : &rootParser->m_accounting.countBytesIndirect; + + /* Detect and avoid integer overflow */ + if (*additionTarget > (XmlBigCount)(-1) - (XmlBigCount)bytesMore) + return XML_FALSE; + *additionTarget += bytesMore; + + const XmlBigCount countBytesOutput + = rootParser->m_accounting.countBytesDirect + + rootParser->m_accounting.countBytesIndirect; + const float amplificationFactor + = accountingGetCurrentAmplification(rootParser); + const XML_Bool tolerated + = (countBytesOutput < rootParser->m_accounting.activationThresholdBytes) + || (amplificationFactor + <= rootParser->m_accounting.maximumAmplificationFactor); + + if (rootParser->m_accounting.debugLevel >= 2) { + accountingReportStats(rootParser, ""); + accountingReportDiff(rootParser, levelsAwayFromRootParser, before, after, + bytesMore, source_line, account); + } + + return tolerated; +} + +unsigned long long +testingAccountingGetCountBytesDirect(XML_Parser parser) { + if (! parser) + return 0; + return parser->m_accounting.countBytesDirect; +} + +unsigned long long +testingAccountingGetCountBytesIndirect(XML_Parser parser) { + if (! parser) + return 0; + return parser->m_accounting.countBytesIndirect; +} + +static void +entityTrackingReportStats(XML_Parser rootParser, ENTITY *entity, + const char *action, int sourceLine) { + assert(! rootParser->m_parentParser); + if (rootParser->m_entity_stats.debugLevel < 1) + return; + +# if defined(XML_UNICODE) + const char *const entityName = "[..]"; +# else + const char *const entityName = entity->name; +# endif + + fprintf( + stderr, + "expat: Entities(%p): Count %9d, depth %2d/%2d %*s%s%s; %s length %d (xmlparse.c:%d)\n", + (void *)rootParser, rootParser->m_entity_stats.countEverOpened, + rootParser->m_entity_stats.currentDepth, + rootParser->m_entity_stats.maximumDepthSeen, + (rootParser->m_entity_stats.currentDepth - 1) * 2, "", + entity->is_param ? "%" : "&", entityName, action, entity->textLen, + sourceLine); +} + +static void +entityTrackingOnOpen(XML_Parser originParser, ENTITY *entity, int sourceLine) { + const XML_Parser rootParser = getRootParserOf(originParser, NULL); + assert(! rootParser->m_parentParser); + + rootParser->m_entity_stats.countEverOpened++; + rootParser->m_entity_stats.currentDepth++; + if (rootParser->m_entity_stats.currentDepth + > rootParser->m_entity_stats.maximumDepthSeen) { + rootParser->m_entity_stats.maximumDepthSeen++; + } + + entityTrackingReportStats(rootParser, entity, "OPEN ", sourceLine); +} + +static void +entityTrackingOnClose(XML_Parser originParser, ENTITY *entity, int sourceLine) { + const XML_Parser rootParser = getRootParserOf(originParser, NULL); + assert(! rootParser->m_parentParser); + + entityTrackingReportStats(rootParser, entity, "CLOSE", sourceLine); + rootParser->m_entity_stats.currentDepth--; +} + +static XML_Parser +getRootParserOf(XML_Parser parser, unsigned int *outLevelDiff) { + XML_Parser rootParser = parser; + unsigned int stepsTakenUpwards = 0; + while (rootParser->m_parentParser) { + rootParser = rootParser->m_parentParser; + stepsTakenUpwards++; + } + assert(! rootParser->m_parentParser); + if (outLevelDiff != NULL) { + *outLevelDiff = stepsTakenUpwards; + } + return rootParser; +} + +const char * +unsignedCharToPrintable(unsigned char c) { + switch (c) { + case 0: + return "\\0"; + case 1: + return "\\x1"; + case 2: + return "\\x2"; + case 3: + return "\\x3"; + case 4: + return "\\x4"; + case 5: + return "\\x5"; + case 6: + return "\\x6"; + case 7: + return "\\x7"; + case 8: + return "\\x8"; + case 9: + return "\\t"; + case 10: + return "\\n"; + case 11: + return "\\xB"; + case 12: + return "\\xC"; + case 13: + return "\\r"; + case 14: + return "\\xE"; + case 15: + return "\\xF"; + case 16: + return "\\x10"; + case 17: + return "\\x11"; + case 18: + return "\\x12"; + case 19: + return "\\x13"; + case 20: + return "\\x14"; + case 21: + return "\\x15"; + case 22: + return "\\x16"; + case 23: + return "\\x17"; + case 24: + return "\\x18"; + case 25: + return "\\x19"; + case 26: + return "\\x1A"; + case 27: + return "\\x1B"; + case 28: + return "\\x1C"; + case 29: + return "\\x1D"; + case 30: + return "\\x1E"; + case 31: + return "\\x1F"; + case 32: + return " "; + case 33: + return "!"; + case 34: + return "\\\""; + case 35: + return "#"; + case 36: + return "$"; + case 37: + return "%"; + case 38: + return "&"; + case 39: + return "'"; + case 40: + return "("; + case 41: + return ")"; + case 42: + return "*"; + case 43: + return "+"; + case 44: + return ","; + case 45: + return "-"; + case 46: + return "."; + case 47: + return "/"; + case 48: + return "0"; + case 49: + return "1"; + case 50: + return "2"; + case 51: + return "3"; + case 52: + return "4"; + case 53: + return "5"; + case 54: + return "6"; + case 55: + return "7"; + case 56: + return "8"; + case 57: + return "9"; + case 58: + return ":"; + case 59: + return ";"; + case 60: + return "<"; + case 61: + return "="; + case 62: + return ">"; + case 63: + return "?"; + case 64: + return "@"; + case 65: + return "A"; + case 66: + return "B"; + case 67: + return "C"; + case 68: + return "D"; + case 69: + return "E"; + case 70: + return "F"; + case 71: + return "G"; + case 72: + return "H"; + case 73: + return "I"; + case 74: + return "J"; + case 75: + return "K"; + case 76: + return "L"; + case 77: + return "M"; + case 78: + return "N"; + case 79: + return "O"; + case 80: + return "P"; + case 81: + return "Q"; + case 82: + return "R"; + case 83: + return "S"; + case 84: + return "T"; + case 85: + return "U"; + case 86: + return "V"; + case 87: + return "W"; + case 88: + return "X"; + case 89: + return "Y"; + case 90: + return "Z"; + case 91: + return "["; + case 92: + return "\\\\"; + case 93: + return "]"; + case 94: + return "^"; + case 95: + return "_"; + case 96: + return "`"; + case 97: + return "a"; + case 98: + return "b"; + case 99: + return "c"; + case 100: + return "d"; + case 101: + return "e"; + case 102: + return "f"; + case 103: + return "g"; + case 104: + return "h"; + case 105: + return "i"; + case 106: + return "j"; + case 107: + return "k"; + case 108: + return "l"; + case 109: + return "m"; + case 110: + return "n"; + case 111: + return "o"; + case 112: + return "p"; + case 113: + return "q"; + case 114: + return "r"; + case 115: + return "s"; + case 116: + return "t"; + case 117: + return "u"; + case 118: + return "v"; + case 119: + return "w"; + case 120: + return "x"; + case 121: + return "y"; + case 122: + return "z"; + case 123: + return "{"; + case 124: + return "|"; + case 125: + return "}"; + case 126: + return "~"; + case 127: + return "\\x7F"; + case 128: + return "\\x80"; + case 129: + return "\\x81"; + case 130: + return "\\x82"; + case 131: + return "\\x83"; + case 132: + return "\\x84"; + case 133: + return "\\x85"; + case 134: + return "\\x86"; + case 135: + return "\\x87"; + case 136: + return "\\x88"; + case 137: + return "\\x89"; + case 138: + return "\\x8A"; + case 139: + return "\\x8B"; + case 140: + return "\\x8C"; + case 141: + return "\\x8D"; + case 142: + return "\\x8E"; + case 143: + return "\\x8F"; + case 144: + return "\\x90"; + case 145: + return "\\x91"; + case 146: + return "\\x92"; + case 147: + return "\\x93"; + case 148: + return "\\x94"; + case 149: + return "\\x95"; + case 150: + return "\\x96"; + case 151: + return "\\x97"; + case 152: + return "\\x98"; + case 153: + return "\\x99"; + case 154: + return "\\x9A"; + case 155: + return "\\x9B"; + case 156: + return "\\x9C"; + case 157: + return "\\x9D"; + case 158: + return "\\x9E"; + case 159: + return "\\x9F"; + case 160: + return "\\xA0"; + case 161: + return "\\xA1"; + case 162: + return "\\xA2"; + case 163: + return "\\xA3"; + case 164: + return "\\xA4"; + case 165: + return "\\xA5"; + case 166: + return "\\xA6"; + case 167: + return "\\xA7"; + case 168: + return "\\xA8"; + case 169: + return "\\xA9"; + case 170: + return "\\xAA"; + case 171: + return "\\xAB"; + case 172: + return "\\xAC"; + case 173: + return "\\xAD"; + case 174: + return "\\xAE"; + case 175: + return "\\xAF"; + case 176: + return "\\xB0"; + case 177: + return "\\xB1"; + case 178: + return "\\xB2"; + case 179: + return "\\xB3"; + case 180: + return "\\xB4"; + case 181: + return "\\xB5"; + case 182: + return "\\xB6"; + case 183: + return "\\xB7"; + case 184: + return "\\xB8"; + case 185: + return "\\xB9"; + case 186: + return "\\xBA"; + case 187: + return "\\xBB"; + case 188: + return "\\xBC"; + case 189: + return "\\xBD"; + case 190: + return "\\xBE"; + case 191: + return "\\xBF"; + case 192: + return "\\xC0"; + case 193: + return "\\xC1"; + case 194: + return "\\xC2"; + case 195: + return "\\xC3"; + case 196: + return "\\xC4"; + case 197: + return "\\xC5"; + case 198: + return "\\xC6"; + case 199: + return "\\xC7"; + case 200: + return "\\xC8"; + case 201: + return "\\xC9"; + case 202: + return "\\xCA"; + case 203: + return "\\xCB"; + case 204: + return "\\xCC"; + case 205: + return "\\xCD"; + case 206: + return "\\xCE"; + case 207: + return "\\xCF"; + case 208: + return "\\xD0"; + case 209: + return "\\xD1"; + case 210: + return "\\xD2"; + case 211: + return "\\xD3"; + case 212: + return "\\xD4"; + case 213: + return "\\xD5"; + case 214: + return "\\xD6"; + case 215: + return "\\xD7"; + case 216: + return "\\xD8"; + case 217: + return "\\xD9"; + case 218: + return "\\xDA"; + case 219: + return "\\xDB"; + case 220: + return "\\xDC"; + case 221: + return "\\xDD"; + case 222: + return "\\xDE"; + case 223: + return "\\xDF"; + case 224: + return "\\xE0"; + case 225: + return "\\xE1"; + case 226: + return "\\xE2"; + case 227: + return "\\xE3"; + case 228: + return "\\xE4"; + case 229: + return "\\xE5"; + case 230: + return "\\xE6"; + case 231: + return "\\xE7"; + case 232: + return "\\xE8"; + case 233: + return "\\xE9"; + case 234: + return "\\xEA"; + case 235: + return "\\xEB"; + case 236: + return "\\xEC"; + case 237: + return "\\xED"; + case 238: + return "\\xEE"; + case 239: + return "\\xEF"; + case 240: + return "\\xF0"; + case 241: + return "\\xF1"; + case 242: + return "\\xF2"; + case 243: + return "\\xF3"; + case 244: + return "\\xF4"; + case 245: + return "\\xF5"; + case 246: + return "\\xF6"; + case 247: + return "\\xF7"; + case 248: + return "\\xF8"; + case 249: + return "\\xF9"; + case 250: + return "\\xFA"; + case 251: + return "\\xFB"; + case 252: + return "\\xFC"; + case 253: + return "\\xFD"; + case 254: + return "\\xFE"; + case 255: + return "\\xFF"; + default: + assert(0); /* never gets here */ + return "dead code"; + } + assert(0); /* never gets here */ +} + +#endif /* XML_DTD */ + +static unsigned long +getDebugLevel(const char *variableName, unsigned long defaultDebugLevel) { + const char *const valueOrNull = getenv(variableName); + if (valueOrNull == NULL) { + return defaultDebugLevel; + } + const char *const value = valueOrNull; + + errno = 0; + char *afterValue = (char *)value; + unsigned long debugLevel = strtoul(value, &afterValue, 10); + if ((errno != 0) || (afterValue[0] != '\0')) { + errno = 0; + return defaultDebugLevel; + } + + return debugLevel; +} diff --git a/deps/EXPAT/expat/xmlrole.c b/deps/EXPAT/expat/xmlrole.c index 8475238d3..79eb6f11c 100644 --- a/deps/EXPAT/expat/xmlrole.c +++ b/deps/EXPAT/expat/xmlrole.c @@ -1,9 +1,47 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Greg Stein + Copyright (c) 2002-2006 Karl Waclawek + Copyright (c) 2002-2003 Fred L. Drake, Jr. + Copyright (c) 2005-2009 Steven Solie + Copyright (c) 2016-2021 Sebastian Pipping + Copyright (c) 2017 Rhodri James + Copyright (c) 2019 David Loffredo + Copyright (c) 2021 Dong-hee Na + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include + #include "expat_config.h" + #include "expat_external.h" #include "internal.h" #include "xmlrole.h" @@ -16,107 +54,88 @@ */ -static const char KW_ANY[] = { - ASCII_A, ASCII_N, ASCII_Y, '\0' }; -static const char KW_ATTLIST[] = { - ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' }; -static const char KW_CDATA[] = { - ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_DOCTYPE[] = { - ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' }; -static const char KW_ELEMENT[] = { - ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' }; -static const char KW_EMPTY[] = { - ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' }; -static const char KW_ENTITIES[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, - '\0' }; -static const char KW_ENTITY[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; -static const char KW_FIXED[] = { - ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' }; -static const char KW_ID[] = { - ASCII_I, ASCII_D, '\0' }; -static const char KW_IDREF[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; -static const char KW_IDREFS[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; +static const char KW_ANY[] = {ASCII_A, ASCII_N, ASCII_Y, '\0'}; +static const char KW_ATTLIST[] + = {ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0'}; +static const char KW_CDATA[] + = {ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0'}; +static const char KW_DOCTYPE[] + = {ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0'}; +static const char KW_ELEMENT[] + = {ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0'}; +static const char KW_EMPTY[] + = {ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0'}; +static const char KW_ENTITIES[] = {ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, + ASCII_I, ASCII_E, ASCII_S, '\0'}; +static const char KW_ENTITY[] + = {ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0'}; +static const char KW_FIXED[] + = {ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0'}; +static const char KW_ID[] = {ASCII_I, ASCII_D, '\0'}; +static const char KW_IDREF[] + = {ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0'}; +static const char KW_IDREFS[] + = {ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0'}; #ifdef XML_DTD -static const char KW_IGNORE[] = { - ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; +static const char KW_IGNORE[] + = {ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0'}; #endif -static const char KW_IMPLIED[] = { - ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; +static const char KW_IMPLIED[] + = {ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0'}; #ifdef XML_DTD -static const char KW_INCLUDE[] = { - ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; +static const char KW_INCLUDE[] + = {ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0'}; #endif -static const char KW_NDATA[] = { - ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_NMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; -static const char KW_NMTOKENS[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, - '\0' }; -static const char KW_NOTATION[] = - { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, - '\0' }; -static const char KW_PCDATA[] = { - ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_PUBLIC[] = { - ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' }; -static const char KW_REQUIRED[] = { - ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, - '\0' }; -static const char KW_SYSTEM[] = { - ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' }; +static const char KW_NDATA[] + = {ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0'}; +static const char KW_NMTOKEN[] + = {ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0'}; +static const char KW_NMTOKENS[] = {ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, + ASCII_E, ASCII_N, ASCII_S, '\0'}; +static const char KW_NOTATION[] = {ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, + ASCII_I, ASCII_O, ASCII_N, '\0'}; +static const char KW_PCDATA[] + = {ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0'}; +static const char KW_PUBLIC[] + = {ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0'}; +static const char KW_REQUIRED[] = {ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, + ASCII_R, ASCII_E, ASCII_D, '\0'}; +static const char KW_SYSTEM[] + = {ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0'}; #ifndef MIN_BYTES_PER_CHAR -#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) +# define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) #endif #ifdef XML_DTD -#define setTopLevel(state) \ - ((state)->handler = ((state)->documentEntity \ - ? internalSubset \ - : externalSubset1)) +# define setTopLevel(state) \ + ((state)->handler \ + = ((state)->documentEntity ? internalSubset : externalSubset1)) #else /* not XML_DTD */ -#define setTopLevel(state) ((state)->handler = internalSubset) +# define setTopLevel(state) ((state)->handler = internalSubset) #endif /* not XML_DTD */ -typedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, +typedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state, int tok, + const char *ptr, const char *end, const ENCODING *enc); -static PROLOG_HANDLER - prolog0, prolog1, prolog2, - doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, - internalSubset, - entity0, entity1, entity2, entity3, entity4, entity5, entity6, - entity7, entity8, entity9, entity10, - notation0, notation1, notation2, notation3, notation4, - attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, - attlist7, attlist8, attlist9, - element0, element1, element2, element3, element4, element5, element6, - element7, +static PROLOG_HANDLER prolog0, prolog1, prolog2, doctype0, doctype1, doctype2, + doctype3, doctype4, doctype5, internalSubset, entity0, entity1, entity2, + entity3, entity4, entity5, entity6, entity7, entity8, entity9, entity10, + notation0, notation1, notation2, notation3, notation4, attlist0, attlist1, + attlist2, attlist3, attlist4, attlist5, attlist6, attlist7, attlist8, + attlist9, element0, element1, element2, element3, element4, element5, + element6, element7, #ifdef XML_DTD - externalSubset0, externalSubset1, - condSect0, condSect1, condSect2, + externalSubset0, externalSubset1, condSect0, condSect1, condSect2, #endif /* XML_DTD */ - declClose, - error; + declClose, error; static int FASTCALL common(PROLOG_STATE *state, int tok); static int PTRCALL -prolog0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +prolog0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: state->handler = prolog1; @@ -133,10 +152,8 @@ prolog0(PROLOG_STATE *state, case XML_TOK_BOM: return XML_ROLE_NONE; case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) + if (! XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, + KW_DOCTYPE)) break; state->handler = doctype0; return XML_ROLE_DOCTYPE_NONE; @@ -148,12 +165,8 @@ prolog0(PROLOG_STATE *state, } static int PTRCALL -prolog1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +prolog1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; @@ -162,12 +175,17 @@ prolog1(PROLOG_STATE *state, case XML_TOK_COMMENT: return XML_ROLE_COMMENT; case XML_TOK_BOM: - return XML_ROLE_NONE; + /* This case can never arise. To reach this role function, the + * parse must have passed through prolog0 and therefore have had + * some form of input, even if only a space. At that point, a + * byte order mark is no longer a valid character (though + * technically it should be interpreted as a non-breaking space), + * so will be rejected by the tokenizing stages. + */ + return XML_ROLE_NONE; /* LCOV_EXCL_LINE */ case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) + if (! XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, + KW_DOCTYPE)) break; state->handler = doctype0; return XML_ROLE_DOCTYPE_NONE; @@ -179,12 +197,11 @@ prolog1(PROLOG_STATE *state, } static int PTRCALL -prolog2(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +prolog2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; @@ -200,12 +217,11 @@ prolog2(PROLOG_STATE *state, } static int PTRCALL -doctype0(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +doctype0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; @@ -218,12 +234,8 @@ doctype0(PROLOG_STATE *state, } static int PTRCALL -doctype1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +doctype1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; @@ -248,12 +260,11 @@ doctype1(PROLOG_STATE *state, } static int PTRCALL -doctype2(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +doctype2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; @@ -265,12 +276,11 @@ doctype2(PROLOG_STATE *state, } static int PTRCALL -doctype3(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +doctype3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; @@ -282,12 +292,11 @@ doctype3(PROLOG_STATE *state, } static int PTRCALL -doctype4(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +doctype4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; @@ -302,12 +311,11 @@ doctype4(PROLOG_STATE *state, } static int PTRCALL -doctype5(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +doctype5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_DOCTYPE_NONE; @@ -319,40 +327,28 @@ doctype5(PROLOG_STATE *state, } static int PTRCALL -internalSubset(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +internalSubset(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; case XML_TOK_DECL_OPEN: - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, + if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_ENTITY)) { state->handler = entity0; return XML_ROLE_ENTITY_NONE; } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, + if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_ATTLIST)) { state->handler = attlist0; return XML_ROLE_ATTLIST_NONE; } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, + if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_ELEMENT)) { state->handler = element0; return XML_ROLE_ELEMENT_NONE; } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, + if (XmlNameMatchesAscii(enc, ptr + 2 * MIN_BYTES_PER_CHAR(enc), end, KW_NOTATION)) { state->handler = notation0; return XML_ROLE_NOTATION_NONE; @@ -376,12 +372,8 @@ internalSubset(PROLOG_STATE *state, #ifdef XML_DTD static int PTRCALL -externalSubset0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +externalSubset0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { state->handler = externalSubset1; if (tok == XML_TOK_XML_DECL) return XML_ROLE_TEXT_DECL; @@ -389,12 +381,8 @@ externalSubset0(PROLOG_STATE *state, } static int PTRCALL -externalSubset1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +externalSubset1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_COND_SECT_OPEN: state->handler = condSect0; @@ -421,12 +409,11 @@ externalSubset1(PROLOG_STATE *state, #endif /* XML_DTD */ static int PTRCALL -entity0(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +entity0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -441,12 +428,11 @@ entity0(PROLOG_STATE *state, } static int PTRCALL -entity1(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +entity1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -458,12 +444,8 @@ entity1(PROLOG_STATE *state, } static int PTRCALL -entity2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +entity2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -486,12 +468,11 @@ entity2(PROLOG_STATE *state, } static int PTRCALL -entity3(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +entity3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -503,12 +484,11 @@ entity3(PROLOG_STATE *state, } static int PTRCALL -entity4(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +entity4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -520,12 +500,8 @@ entity4(PROLOG_STATE *state, } static int PTRCALL -entity5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +entity5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -543,12 +519,11 @@ entity5(PROLOG_STATE *state, } static int PTRCALL -entity6(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +entity6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -561,12 +536,8 @@ entity6(PROLOG_STATE *state, } static int PTRCALL -entity7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +entity7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -589,12 +560,11 @@ entity7(PROLOG_STATE *state, } static int PTRCALL -entity8(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +entity8(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -606,12 +576,11 @@ entity8(PROLOG_STATE *state, } static int PTRCALL -entity9(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +entity9(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -623,12 +592,11 @@ entity9(PROLOG_STATE *state, } static int PTRCALL -entity10(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +entity10(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ENTITY_NONE; @@ -640,12 +608,11 @@ entity10(PROLOG_STATE *state, } static int PTRCALL -notation0(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +notation0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; @@ -657,12 +624,8 @@ notation0(PROLOG_STATE *state, } static int PTRCALL -notation1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +notation1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; @@ -681,12 +644,11 @@ notation1(PROLOG_STATE *state, } static int PTRCALL -notation2(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +notation2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; @@ -698,12 +660,11 @@ notation2(PROLOG_STATE *state, } static int PTRCALL -notation3(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +notation3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; @@ -716,12 +677,11 @@ notation3(PROLOG_STATE *state, } static int PTRCALL -notation4(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +notation4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NOTATION_NONE; @@ -737,12 +697,11 @@ notation4(PROLOG_STATE *state, } static int PTRCALL -attlist0(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +attlist0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; @@ -755,12 +714,11 @@ attlist0(PROLOG_STATE *state, } static int PTRCALL -attlist1(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +attlist1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; @@ -776,34 +734,23 @@ attlist1(PROLOG_STATE *state, } static int PTRCALL -attlist2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +attlist2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - { - static const char * const types[] = { - KW_CDATA, - KW_ID, - KW_IDREF, - KW_IDREFS, - KW_ENTITY, - KW_ENTITIES, - KW_NMTOKEN, - KW_NMTOKENS, - }; - int i; - for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) - if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { - state->handler = attlist8; - return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; - } - } + case XML_TOK_NAME: { + static const char *const types[] = { + KW_CDATA, KW_ID, KW_IDREF, KW_IDREFS, + KW_ENTITY, KW_ENTITIES, KW_NMTOKEN, KW_NMTOKENS, + }; + int i; + for (i = 0; i < (int)(sizeof(types) / sizeof(types[0])); i++) + if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { + state->handler = attlist8; + return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; + } + } if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) { state->handler = attlist5; return XML_ROLE_ATTLIST_NONE; @@ -817,12 +764,11 @@ attlist2(PROLOG_STATE *state, } static int PTRCALL -attlist3(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +attlist3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; @@ -836,12 +782,11 @@ attlist3(PROLOG_STATE *state, } static int PTRCALL -attlist4(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +attlist4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; @@ -856,12 +801,11 @@ attlist4(PROLOG_STATE *state, } static int PTRCALL -attlist5(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +attlist5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; @@ -873,12 +817,11 @@ attlist5(PROLOG_STATE *state, } static int PTRCALL -attlist6(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +attlist6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; @@ -890,12 +833,11 @@ attlist6(PROLOG_STATE *state, } static int PTRCALL -attlist7(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +attlist7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; @@ -911,33 +853,23 @@ attlist7(PROLOG_STATE *state, /* default value */ static int PTRCALL -attlist8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +attlist8(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, + if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, KW_IMPLIED)) { state->handler = attlist1; return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, + if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, KW_REQUIRED)) { state->handler = attlist1; return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, + if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, KW_FIXED)) { state->handler = attlist9; return XML_ROLE_ATTLIST_NONE; @@ -951,12 +883,11 @@ attlist8(PROLOG_STATE *state, } static int PTRCALL -attlist9(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +attlist9(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ATTLIST_NONE; @@ -968,12 +899,11 @@ attlist9(PROLOG_STATE *state, } static int PTRCALL -element0(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +element0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; @@ -986,12 +916,8 @@ element0(PROLOG_STATE *state, } static int PTRCALL -element1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +element1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; @@ -1016,19 +942,13 @@ element1(PROLOG_STATE *state, } static int PTRCALL -element2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +element2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, + if (XmlNameMatchesAscii(enc, ptr + MIN_BYTES_PER_CHAR(enc), end, KW_PCDATA)) { state->handler = element3; return XML_ROLE_CONTENT_PCDATA; @@ -1056,12 +976,11 @@ element2(PROLOG_STATE *state, } static int PTRCALL -element3(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +element3(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; @@ -1081,12 +1000,11 @@ element3(PROLOG_STATE *state, } static int PTRCALL -element4(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +element4(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; @@ -1099,12 +1017,11 @@ element4(PROLOG_STATE *state, } static int PTRCALL -element5(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +element5(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; @@ -1120,12 +1037,11 @@ element5(PROLOG_STATE *state, } static int PTRCALL -element6(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +element6(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; @@ -1150,12 +1066,11 @@ element6(PROLOG_STATE *state, } static int PTRCALL -element7(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +element7(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_ELEMENT_NONE; @@ -1200,12 +1115,8 @@ element7(PROLOG_STATE *state, #ifdef XML_DTD static int PTRCALL -condSect0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ +condSect0(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; @@ -1224,12 +1135,11 @@ condSect0(PROLOG_STATE *state, } static int PTRCALL -condSect1(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +condSect1(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; @@ -1242,12 +1152,11 @@ condSect1(PROLOG_STATE *state, } static int PTRCALL -condSect2(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +condSect2(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return XML_ROLE_NONE; @@ -1261,12 +1170,11 @@ condSect2(PROLOG_STATE *state, #endif /* XML_DTD */ static int PTRCALL -declClose(PROLOG_STATE *state, - int tok, - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +declClose(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); switch (tok) { case XML_TOK_PROLOG_S: return state->role_none; @@ -1277,30 +1185,52 @@ declClose(PROLOG_STATE *state, return common(state, tok); } +/* This function will only be invoked if the internal logic of the + * parser has broken down. It is used in two cases: + * + * 1: When the XML prolog has been finished. At this point the + * processor (the parser level above these role handlers) should + * switch from prologProcessor to contentProcessor and reinitialise + * the handler function. + * + * 2: When an error has been detected (via common() below). At this + * point again the processor should be switched to errorProcessor, + * which will never call a handler. + * + * The result of this is that error() can only be called if the + * processor switch failed to happen, which is an internal error and + * therefore we shouldn't be able to provoke it simply by using the + * library. It is a necessary backstop, however, so we merely exclude + * it from the coverage statistics. + * + * LCOV_EXCL_START + */ static int PTRCALL -error(PROLOG_STATE *UNUSED_P(state), - int UNUSED_P(tok), - const char *UNUSED_P(ptr), - const char *UNUSED_P(end), - const ENCODING *UNUSED_P(enc)) -{ +error(PROLOG_STATE *state, int tok, const char *ptr, const char *end, + const ENCODING *enc) { + UNUSED_P(state); + UNUSED_P(tok); + UNUSED_P(ptr); + UNUSED_P(end); + UNUSED_P(enc); return XML_ROLE_NONE; } +/* LCOV_EXCL_STOP */ static int FASTCALL -common(PROLOG_STATE *state, int tok) -{ +common(PROLOG_STATE *state, int tok) { #ifdef XML_DTD - if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) + if (! state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) return XML_ROLE_INNER_PARAM_ENTITY_REF; +#else + UNUSED_P(tok); #endif state->handler = error; return XML_ROLE_ERROR; } void -XmlPrologStateInit(PROLOG_STATE *state) -{ +XmlPrologStateInit(PROLOG_STATE *state) { state->handler = prolog0; #ifdef XML_DTD state->documentEntity = 1; @@ -1312,8 +1242,7 @@ XmlPrologStateInit(PROLOG_STATE *state) #ifdef XML_DTD void -XmlPrologStateInitExternalEntity(PROLOG_STATE *state) -{ +XmlPrologStateInitExternalEntity(PROLOG_STATE *state) { state->handler = externalSubset0; state->documentEntity = 0; state->includeLevel = 0; diff --git a/deps/EXPAT/expat/xmlrole.h b/deps/EXPAT/expat/xmlrole.h index 4dd9f06f9..d6e1fa150 100644 --- a/deps/EXPAT/expat/xmlrole.h +++ b/deps/EXPAT/expat/xmlrole.h @@ -1,5 +1,36 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Karl Waclawek + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2017 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlRole_INCLUDED @@ -8,7 +39,7 @@ #ifdef __VMS /* 0 1 2 3 0 1 2 3 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt +# define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt #endif #include "xmltok.h" @@ -85,11 +116,8 @@ enum { }; typedef struct prolog_state { - int (PTRCALL *handler) (struct prolog_state *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); + int(PTRCALL *handler)(struct prolog_state *state, int tok, const char *ptr, + const char *end, const ENCODING *enc); unsigned level; int role_none; #ifdef XML_DTD @@ -104,8 +132,8 @@ void XmlPrologStateInit(PROLOG_STATE *); void XmlPrologStateInitExternalEntity(PROLOG_STATE *); #endif /* XML_DTD */ -#define XmlTokenRole(state, tok, ptr, end, enc) \ - (((state)->handler)(state, tok, ptr, end, enc)) +#define XmlTokenRole(state, tok, ptr, end, enc) \ + (((state)->handler)(state, tok, ptr, end, enc)) #ifdef __cplusplus } diff --git a/deps/EXPAT/expat/xmltok.c b/deps/EXPAT/expat/xmltok.c index f10b459ff..45947d115 100644 --- a/deps/EXPAT/expat/xmltok.c +++ b/deps/EXPAT/expat/xmltok.c @@ -1,68 +1,99 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2001-2003 Fred L. Drake, Jr. + Copyright (c) 2002 Greg Stein + Copyright (c) 2002-2016 Karl Waclawek + Copyright (c) 2005-2009 Steven Solie + Copyright (c) 2016-2022 Sebastian Pipping + Copyright (c) 2016 Pascal Cuoq + Copyright (c) 2016 Don Lewis + Copyright (c) 2017 Rhodri James + Copyright (c) 2017 Alexander Bluhm + Copyright (c) 2017 Benbuck Nason + Copyright (c) 2017 José Gutiérrez de la Concha + Copyright (c) 2019 David Loffredo + Copyright (c) 2021 Dong-hee Na + Copyright (c) 2022 Martin Ettl + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include +#include /* memcpy */ +#include + #include "expat_config.h" + #include "expat_external.h" #include "internal.h" #include "xmltok.h" #include "nametab.h" #ifdef XML_DTD -#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) +# define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) #else -#define IGNORE_SECTION_TOK_VTABLE /* as nothing */ +# define IGNORE_SECTION_TOK_VTABLE /* as nothing */ #endif -#define VTABLE1 \ - { PREFIX(prologTok), PREFIX(contentTok), \ - PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ - { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ - PREFIX(sameName), \ - PREFIX(nameMatchesAscii), \ - PREFIX(nameLength), \ - PREFIX(skipS), \ - PREFIX(getAtts), \ - PREFIX(charRefNumber), \ - PREFIX(predefinedEntityName), \ - PREFIX(updatePosition), \ - PREFIX(isPublicId) +#define VTABLE1 \ + {PREFIX(prologTok), PREFIX(contentTok), \ + PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE}, \ + {PREFIX(attributeValueTok), PREFIX(entityValueTok)}, \ + PREFIX(nameMatchesAscii), PREFIX(nameLength), PREFIX(skipS), \ + PREFIX(getAtts), PREFIX(charRefNumber), PREFIX(predefinedEntityName), \ + PREFIX(updatePosition), PREFIX(isPublicId) #define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) -#define UCS2_GET_NAMING(pages, hi, lo) \ - (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1u << ((lo) & 0x1F))) +#define UCS2_GET_NAMING(pages, hi, lo) \ + (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1u << ((lo)&0x1F))) /* A 2 byte UTF-8 representation splits the characters 11 bits between the bottom 5 and 6 bits of the bytes. We need 8 bits to index into pages, 3 bits to add to that index and 5 bits to generate the mask. */ -#define UTF8_GET_NAMING2(pages, byte) \ - (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ - + ((((byte)[0]) & 3) << 1) \ - + ((((byte)[1]) >> 5) & 1)] \ - & (1u << (((byte)[1]) & 0x1F))) +#define UTF8_GET_NAMING2(pages, byte) \ + (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ + + ((((byte)[0]) & 3) << 1) + ((((byte)[1]) >> 5) & 1)] \ + & (1u << (((byte)[1]) & 0x1F))) /* A 3 byte UTF-8 representation splits the characters 16 bits between the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index into pages, 3 bits to add to that index and 5 bits to generate the mask. */ -#define UTF8_GET_NAMING3(pages, byte) \ - (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ - + ((((byte)[1]) >> 2) & 0xF)] \ - << 3) \ - + ((((byte)[1]) & 3) << 1) \ - + ((((byte)[2]) >> 5) & 1)] \ - & (1u << (((byte)[2]) & 0x1F))) - -#define UTF8_GET_NAMING(pages, p, n) \ - ((n) == 2 \ - ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ - : ((n) == 3 \ - ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ - : 0)) +#define UTF8_GET_NAMING3(pages, byte) \ + (namingBitmap \ + [((pages)[((((byte)[0]) & 0xF) << 4) + ((((byte)[1]) >> 2) & 0xF)] \ + << 3) \ + + ((((byte)[1]) & 3) << 1) + ((((byte)[2]) >> 5) & 1)] \ + & (1u << (((byte)[2]) & 0x1F))) /* Detection of invalid UTF-8 sequences is based on Table 3.1B of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/ @@ -74,88 +105,76 @@ (A & 0xC0) == 0xC0 means A > 0xBF */ -#define UTF8_INVALID2(p) \ +#define UTF8_INVALID2(p) \ ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0) -#define UTF8_INVALID3(p) \ - (((p)[2] & 0x80) == 0 \ - || \ - ((*p) == 0xEF && (p)[1] == 0xBF \ - ? \ - (p)[2] > 0xBD \ - : \ - ((p)[2] & 0xC0) == 0xC0) \ - || \ - ((*p) == 0xE0 \ - ? \ - (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0))) +#define UTF8_INVALID3(p) \ + (((p)[2] & 0x80) == 0 \ + || ((*p) == 0xEF && (p)[1] == 0xBF ? (p)[2] > 0xBD \ + : ((p)[2] & 0xC0) == 0xC0) \ + || ((*p) == 0xE0 \ + ? (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \ + : ((p)[1] & 0x80) == 0 \ + || ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0))) -#define UTF8_INVALID4(p) \ - (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \ - || \ - ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \ - || \ - ((*p) == 0xF0 \ - ? \ - (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) +#define UTF8_INVALID4(p) \ + (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 || ((p)[2] & 0x80) == 0 \ + || ((p)[2] & 0xC0) == 0xC0 \ + || ((*p) == 0xF0 \ + ? (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \ + : ((p)[1] & 0x80) == 0 \ + || ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) static int PTRFASTCALL -isNever(const ENCODING *UNUSED_P(enc), const char *UNUSED_P(p)) -{ +isNever(const ENCODING *enc, const char *p) { + UNUSED_P(enc); + UNUSED_P(p); return 0; } static int PTRFASTCALL -utf8_isName2(const ENCODING *UNUSED_P(enc), const char *p) -{ +utf8_isName2(const ENCODING *enc, const char *p) { + UNUSED_P(enc); return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); } static int PTRFASTCALL -utf8_isName3(const ENCODING *UNUSED_P(enc), const char *p) -{ +utf8_isName3(const ENCODING *enc, const char *p) { + UNUSED_P(enc); return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); } #define utf8_isName4 isNever static int PTRFASTCALL -utf8_isNmstrt2(const ENCODING *UNUSED_P(enc), const char *p) -{ +utf8_isNmstrt2(const ENCODING *enc, const char *p) { + UNUSED_P(enc); return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); } static int PTRFASTCALL -utf8_isNmstrt3(const ENCODING *UNUSED_P(enc), const char *p) -{ +utf8_isNmstrt3(const ENCODING *enc, const char *p) { + UNUSED_P(enc); return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); } #define utf8_isNmstrt4 isNever static int PTRFASTCALL -utf8_isInvalid2(const ENCODING *UNUSED_P(enc), const char *p) -{ +utf8_isInvalid2(const ENCODING *enc, const char *p) { + UNUSED_P(enc); return UTF8_INVALID2((const unsigned char *)p); } static int PTRFASTCALL -utf8_isInvalid3(const ENCODING *UNUSED_P(enc), const char *p) -{ +utf8_isInvalid3(const ENCODING *enc, const char *p) { + UNUSED_P(enc); return UTF8_INVALID3((const unsigned char *)p); } static int PTRFASTCALL -utf8_isInvalid4(const ENCODING *UNUSED_P(enc), const char *p) -{ +utf8_isInvalid4(const ENCODING *enc, const char *p) { + UNUSED_P(enc); return UTF8_INVALID4((const unsigned char *)p); } @@ -163,61 +182,44 @@ struct normal_encoding { ENCODING enc; unsigned char type[256]; #ifdef XML_MIN_SIZE - int (PTRFASTCALL *byteType)(const ENCODING *, const char *); - int (PTRFASTCALL *isNameMin)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *); - int (PTRFASTCALL *byteToAscii)(const ENCODING *, const char *); - int (PTRCALL *charMatches)(const ENCODING *, const char *, int); + int(PTRFASTCALL *byteType)(const ENCODING *, const char *); + int(PTRFASTCALL *isNameMin)(const ENCODING *, const char *); + int(PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *); + int(PTRFASTCALL *byteToAscii)(const ENCODING *, const char *); + int(PTRCALL *charMatches)(const ENCODING *, const char *, int); #endif /* XML_MIN_SIZE */ - int (PTRFASTCALL *isName2)(const ENCODING *, const char *); - int (PTRFASTCALL *isName3)(const ENCODING *, const char *); - int (PTRFASTCALL *isName4)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid2)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid3)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid4)(const ENCODING *, const char *); + int(PTRFASTCALL *isName2)(const ENCODING *, const char *); + int(PTRFASTCALL *isName3)(const ENCODING *, const char *); + int(PTRFASTCALL *isName4)(const ENCODING *, const char *); + int(PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *); + int(PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *); + int(PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *); + int(PTRFASTCALL *isInvalid2)(const ENCODING *, const char *); + int(PTRFASTCALL *isInvalid3)(const ENCODING *, const char *); + int(PTRFASTCALL *isInvalid4)(const ENCODING *, const char *); }; -#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc)) +#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *)(enc)) #ifdef XML_MIN_SIZE -#define STANDARD_VTABLE(E) \ - E ## byteType, \ - E ## isNameMin, \ - E ## isNmstrtMin, \ - E ## byteToAscii, \ - E ## charMatches, +# define STANDARD_VTABLE(E) \ + E##byteType, E##isNameMin, E##isNmstrtMin, E##byteToAscii, E##charMatches, #else -#define STANDARD_VTABLE(E) /* as nothing */ +# define STANDARD_VTABLE(E) /* as nothing */ #endif -#define NORMAL_VTABLE(E) \ - E ## isName2, \ - E ## isName3, \ - E ## isName4, \ - E ## isNmstrt2, \ - E ## isNmstrt3, \ - E ## isNmstrt4, \ - E ## isInvalid2, \ - E ## isInvalid3, \ - E ## isInvalid4 +#define NORMAL_VTABLE(E) \ + E##isName2, E##isName3, E##isName4, E##isNmstrt2, E##isNmstrt3, \ + E##isNmstrt4, E##isInvalid2, E##isInvalid3, E##isInvalid4 -#define NULL_VTABLE \ - /* isName2 */ NULL, \ - /* isName3 */ NULL, \ - /* isName4 */ NULL, \ - /* isNmstrt2 */ NULL, \ - /* isNmstrt3 */ NULL, \ - /* isNmstrt4 */ NULL, \ - /* isInvalid2 */ NULL, \ - /* isInvalid3 */ NULL, \ - /* isInvalid4 */ NULL +#define NULL_VTABLE \ + /* isName2 */ NULL, /* isName3 */ NULL, /* isName4 */ NULL, \ + /* isNmstrt2 */ NULL, /* isNmstrt3 */ NULL, /* isNmstrt4 */ NULL, \ + /* isInvalid2 */ NULL, /* isInvalid3 */ NULL, /* isInvalid4 */ NULL static int FASTCALL checkCharRefNumber(int); @@ -225,75 +227,76 @@ static int FASTCALL checkCharRefNumber(int); #include "ascii.h" #ifdef XML_MIN_SIZE -#define sb_isNameMin isNever -#define sb_isNmstrtMin isNever +# define sb_isNameMin isNever +# define sb_isNmstrtMin isNever #endif #ifdef XML_MIN_SIZE -#define MINBPC(enc) ((enc)->minBytesPerChar) +# define MINBPC(enc) ((enc)->minBytesPerChar) #else /* minimum bytes per character */ -#define MINBPC(enc) 1 +# define MINBPC(enc) 1 #endif -#define SB_BYTE_TYPE(enc, p) \ +#define SB_BYTE_TYPE(enc, p) \ (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) #ifdef XML_MIN_SIZE static int PTRFASTCALL -sb_byteType(const ENCODING *enc, const char *p) -{ +sb_byteType(const ENCODING *enc, const char *p) { return SB_BYTE_TYPE(enc, p); } -#define BYTE_TYPE(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteType(enc, p)) +# define BYTE_TYPE(enc, p) (AS_NORMAL_ENCODING(enc)->byteType(enc, p)) #else -#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) +# define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) #endif #ifdef XML_MIN_SIZE -#define BYTE_TO_ASCII(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p)) +# define BYTE_TO_ASCII(enc, p) (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p)) static int PTRFASTCALL -sb_byteToAscii(const ENCODING *enc, const char *p) -{ +sb_byteToAscii(const ENCODING *enc, const char *p) { + UNUSED_P(enc); return *p; } #else -#define BYTE_TO_ASCII(enc, p) (*(p)) +# define BYTE_TO_ASCII(enc, p) (*(p)) #endif -#define IS_NAME_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p)) -#define IS_NMSTRT_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p)) -#define IS_INVALID_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p)) - +#define IS_NAME_CHAR(enc, p, n) (AS_NORMAL_ENCODING(enc)->isName##n(enc, p)) +#define IS_NMSTRT_CHAR(enc, p, n) (AS_NORMAL_ENCODING(enc)->isNmstrt##n(enc, p)) #ifdef XML_MIN_SIZE -#define IS_NAME_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p)) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p)) +# define IS_INVALID_CHAR(enc, p, n) \ + (AS_NORMAL_ENCODING(enc)->isInvalid##n \ + && AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p)) #else -#define IS_NAME_CHAR_MINBPC(enc, p) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) +# define IS_INVALID_CHAR(enc, p, n) \ + (AS_NORMAL_ENCODING(enc)->isInvalid##n(enc, p)) #endif #ifdef XML_MIN_SIZE -#define CHAR_MATCHES(enc, p, c) \ - (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c)) +# define IS_NAME_CHAR_MINBPC(enc, p) \ + (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p)) +# define IS_NMSTRT_CHAR_MINBPC(enc, p) \ + (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p)) +#else +# define IS_NAME_CHAR_MINBPC(enc, p) (0) +# define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) +#endif + +#ifdef XML_MIN_SIZE +# define CHAR_MATCHES(enc, p, c) \ + (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c)) static int PTRCALL -sb_charMatches(const ENCODING *enc, const char *p, int c) -{ +sb_charMatches(const ENCODING *enc, const char *p, int c) { + UNUSED_P(enc); return *p == c; } #else /* c is an ASCII character */ -#define CHAR_MATCHES(enc, p, c) (*(p) == c) +# define CHAR_MATCHES(enc, p, c) (*(p) == (c)) #endif -#define PREFIX(ident) normal_ ## ident +#define PREFIX(ident) normal_##ident #define XML_TOK_IMPL_C #include "xmltok_impl.inc" #undef XML_TOK_IMPL_C @@ -308,42 +311,46 @@ sb_charMatches(const ENCODING *enc, const char *p, int c) #undef IS_NMSTRT_CHAR_MINBPC #undef IS_INVALID_CHAR -enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ - UTF8_cval1 = 0x00, - UTF8_cval2 = 0xc0, - UTF8_cval3 = 0xe0, - UTF8_cval4 = 0xf0 +enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ + UTF8_cval1 = 0x00, + UTF8_cval2 = 0xc0, + UTF8_cval3 = 0xe0, + UTF8_cval4 = 0xf0 }; void -align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef) -{ - const char * fromLim = *fromLimRef; +_INTERNAL_trim_to_complete_utf8_characters(const char *from, + const char **fromLimRef) { + const char *fromLim = *fromLimRef; size_t walked = 0; for (; fromLim > from; fromLim--, walked++) { const unsigned char prev = (unsigned char)fromLim[-1]; - if ((prev & 0xf8u) == 0xf0u) { /* 4-byte character, lead by 0b11110xxx byte */ + if ((prev & 0xf8u) + == 0xf0u) { /* 4-byte character, lead by 0b11110xxx byte */ if (walked + 1 >= 4) { fromLim += 4 - 1; break; } else { walked = 0; } - } else if ((prev & 0xf0u) == 0xe0u) { /* 3-byte character, lead by 0b1110xxxx byte */ + } else if ((prev & 0xf0u) + == 0xe0u) { /* 3-byte character, lead by 0b1110xxxx byte */ if (walked + 1 >= 3) { fromLim += 3 - 1; break; } else { walked = 0; } - } else if ((prev & 0xe0u) == 0xc0u) { /* 2-byte character, lead by 0b110xxxxx byte */ + } else if ((prev & 0xe0u) + == 0xc0u) { /* 2-byte character, lead by 0b110xxxxx byte */ if (walked + 1 >= 2) { fromLim += 2 - 1; break; } else { walked = 0; } - } else if ((prev & 0x80u) == 0x00u) { /* 1-byte character, matching 0b0xxxxxxx */ + } else if ((prev & 0x80u) + == 0x00u) { /* 1-byte character, matching 0b0xxxxxxx */ break; } } @@ -351,35 +358,47 @@ align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef) } static enum XML_Convert_Result PTRCALL -utf8_toUtf8(const ENCODING *UNUSED_P(enc), - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - enum XML_Convert_Result res = XML_CONVERT_COMPLETED; - char *to; - const char *from; - if (fromLim - *fromP > toLim - *toP) { - /* Avoid copying partial characters. */ - res = XML_CONVERT_OUTPUT_EXHAUSTED; - fromLim = *fromP + (toLim - *toP); - align_limit_to_full_utf8_characters(*fromP, &fromLim); - } - for (to = *toP, from = *fromP; (from < fromLim) && (to < toLim); from++, to++) - *to = *from; - *fromP = from; - *toP = to; +utf8_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, + char **toP, const char *toLim) { + bool input_incomplete = false; + bool output_exhausted = false; - if ((to == toLim) && (from < fromLim)) + /* Avoid copying partial characters (due to limited space). */ + const ptrdiff_t bytesAvailable = fromLim - *fromP; + const ptrdiff_t bytesStorable = toLim - *toP; + UNUSED_P(enc); + if (bytesAvailable > bytesStorable) { + fromLim = *fromP + bytesStorable; + output_exhausted = true; + } + + /* Avoid copying partial characters (from incomplete input). */ + { + const char *const fromLimBefore = fromLim; + _INTERNAL_trim_to_complete_utf8_characters(*fromP, &fromLim); + if (fromLim < fromLimBefore) { + input_incomplete = true; + } + } + + { + const ptrdiff_t bytesToCopy = fromLim - *fromP; + memcpy(*toP, *fromP, bytesToCopy); + *fromP += bytesToCopy; + *toP += bytesToCopy; + } + + if (output_exhausted) /* needs to go first */ return XML_CONVERT_OUTPUT_EXHAUSTED; + else if (input_incomplete) + return XML_CONVERT_INPUT_INCOMPLETE; else - return res; + return XML_CONVERT_COMPLETED; } static enum XML_Convert_Result PTRCALL -utf8_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ +utf8_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) { enum XML_Convert_Result res = XML_CONVERT_COMPLETED; unsigned short *to = *toP; const char *from = *fromP; @@ -388,7 +407,7 @@ utf8_toUtf16(const ENCODING *enc, case BT_LEAD2: if (fromLim - from < 2) { res = XML_CONVERT_INPUT_INCOMPLETE; - break; + goto after; } *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); from += 2; @@ -396,37 +415,37 @@ utf8_toUtf16(const ENCODING *enc, case BT_LEAD3: if (fromLim - from < 3) { res = XML_CONVERT_INPUT_INCOMPLETE; - break; + goto after; } - *to++ = (unsigned short)(((from[0] & 0xf) << 12) - | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); + *to++ = (unsigned short)(((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) + | (from[2] & 0x3f)); from += 3; break; - case BT_LEAD4: - { - unsigned long n; - if (toLim - to < 2) { - res = XML_CONVERT_OUTPUT_EXHAUSTED; - goto after; - } - if (fromLim - from < 4) { - res = XML_CONVERT_INPUT_INCOMPLETE; - goto after; - } - n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) - | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); - n -= 0x10000; - to[0] = (unsigned short)((n >> 10) | 0xD800); - to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); - to += 2; - from += 4; + case BT_LEAD4: { + unsigned long n; + if (toLim - to < 2) { + res = XML_CONVERT_OUTPUT_EXHAUSTED; + goto after; } - break; + if (fromLim - from < 4) { + res = XML_CONVERT_INPUT_INCOMPLETE; + goto after; + } + n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) + | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); + n -= 0x10000; + to[0] = (unsigned short)((n >> 10) | 0xD800); + to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); + to += 2; + from += 4; + } break; default: *to++ = *from++; break; } } + if (from < fromLim) + res = XML_CONVERT_OUTPUT_EXHAUSTED; after: *fromP = from; *toP = to; @@ -434,56 +453,51 @@ after: } #ifdef XML_NS -static const struct normal_encoding utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; +static const struct normal_encoding utf8_encoding_ns + = {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0}, + { +# include "asciitab.h" +# include "utf8tab.h" + }, + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)}; #endif -static const struct normal_encoding utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { +static const struct normal_encoding utf8_encoding + = {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0}, + { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; + }, + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)}; #ifdef XML_NS -static const struct normal_encoding internal_utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "iasciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; +static const struct normal_encoding internal_utf8_encoding_ns + = {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0}, + { +# include "iasciitab.h" +# include "utf8tab.h" + }, + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)}; #endif -static const struct normal_encoding internal_utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { +static const struct normal_encoding internal_utf8_encoding + = {{VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0}, + { #define BT_COLON BT_NMSTRT #include "iasciitab.h" #undef BT_COLON #include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; + }, + STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)}; static enum XML_Convert_Result PTRCALL -latin1_toUtf8(const ENCODING *UNUSED_P(enc), - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ +latin1_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, + char **toP, const char *toLim) { + UNUSED_P(enc); for (;;) { unsigned char c; if (*fromP == fromLim) @@ -495,8 +509,7 @@ latin1_toUtf8(const ENCODING *UNUSED_P(enc), *(*toP)++ = (char)((c >> 6) | UTF8_cval2); *(*toP)++ = (char)((c & 0x3f) | 0x80); (*fromP)++; - } - else { + } else { if (*toP == toLim) return XML_CONVERT_OUTPUT_EXHAUSTED; *(*toP)++ = *(*fromP)++; @@ -505,10 +518,9 @@ latin1_toUtf8(const ENCODING *UNUSED_P(enc), } static enum XML_Convert_Result PTRCALL -latin1_toUtf16(const ENCODING *UNUSED_P(enc), - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ +latin1_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) { + UNUSED_P(enc); while (*fromP < fromLim && *toP < toLim) *(*toP)++ = (unsigned char)*(*fromP)++; @@ -520,33 +532,30 @@ latin1_toUtf16(const ENCODING *UNUSED_P(enc), #ifdef XML_NS -static const struct normal_encoding latin1_encoding_ns = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) NULL_VTABLE -}; +static const struct normal_encoding latin1_encoding_ns + = {{VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0}, + { +# include "asciitab.h" +# include "latin1tab.h" + }, + STANDARD_VTABLE(sb_) NULL_VTABLE}; #endif -static const struct normal_encoding latin1_encoding = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { +static const struct normal_encoding latin1_encoding + = {{VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0}, + { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) NULL_VTABLE -}; + }, + STANDARD_VTABLE(sb_) NULL_VTABLE}; static enum XML_Convert_Result PTRCALL -ascii_toUtf8(const ENCODING *UNUSED_P(enc), - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ +ascii_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, + char **toP, const char *toLim) { + UNUSED_P(enc); while (*fromP < fromLim && *toP < toLim) *(*toP)++ = *(*fromP)++; @@ -558,40 +567,45 @@ ascii_toUtf8(const ENCODING *UNUSED_P(enc), #ifdef XML_NS -static const struct normal_encoding ascii_encoding_ns = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) NULL_VTABLE -}; +static const struct normal_encoding ascii_encoding_ns + = {{VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0}, + { +# include "asciitab.h" + /* BT_NONXML == 0 */ + }, + STANDARD_VTABLE(sb_) NULL_VTABLE}; #endif -static const struct normal_encoding ascii_encoding = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { +static const struct normal_encoding ascii_encoding + = {{VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0}, + { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) NULL_VTABLE -}; + /* BT_NONXML == 0 */ + }, + STANDARD_VTABLE(sb_) NULL_VTABLE}; static int PTRFASTCALL -unicode_byte_type(char hi, char lo) -{ +unicode_byte_type(char hi, char lo) { switch ((unsigned char)hi) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: + /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */ + case 0xD8: + case 0xD9: + case 0xDA: + case 0xDB: return BT_LEAD4; - case 0xDC: case 0xDD: case 0xDE: case 0xDF: + /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */ + case 0xDC: + case 0xDD: + case 0xDE: + case 0xDF: return BT_TRAIL; case 0xFF: switch ((unsigned char)lo) { - case 0xFF: - case 0xFE: + case 0xFF: /* noncharacter-FFFF */ + case 0xFE: /* noncharacter-FFFE */ return BT_NONXML; } break; @@ -599,102 +613,105 @@ unicode_byte_type(char hi, char lo) return BT_NONASCII; } -#define DEFINE_UTF16_TO_UTF8(E) \ -static enum XML_Convert_Result PTRCALL \ -E ## toUtf8(const ENCODING *UNUSED_P(enc), \ - const char **fromP, const char *fromLim, \ - char **toP, const char *toLim) \ -{ \ - const char *from = *fromP; \ - fromLim = from + (((fromLim - from) >> 1) << 1); /* shrink to even */ \ - for (; from < fromLim; from += 2) { \ - int plane; \ - unsigned char lo2; \ - unsigned char lo = GET_LO(from); \ - unsigned char hi = GET_HI(from); \ - switch (hi) { \ - case 0: \ - if (lo < 0x80) { \ - if (*toP == toLim) { \ - *fromP = from; \ - return XML_CONVERT_OUTPUT_EXHAUSTED; \ - } \ - *(*toP)++ = lo; \ - break; \ - } \ - /* fall through */ \ - case 0x1: case 0x2: case 0x3: \ - case 0x4: case 0x5: case 0x6: case 0x7: \ - if (toLim - *toP < 2) { \ - *fromP = from; \ - return XML_CONVERT_OUTPUT_EXHAUSTED; \ - } \ - *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - default: \ - if (toLim - *toP < 3) { \ - *fromP = from; \ - return XML_CONVERT_OUTPUT_EXHAUSTED; \ - } \ - /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ - *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ - *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ - if (toLim - *toP < 4) { \ - *fromP = from; \ - return XML_CONVERT_OUTPUT_EXHAUSTED; \ - } \ - if (fromLim - from < 4) { \ - *fromP = from; \ - return XML_CONVERT_INPUT_INCOMPLETE; \ - } \ - plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ - *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ - *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ - from += 2; \ - lo2 = GET_LO(from); \ - *(*toP)++ = (((lo & 0x3) << 4) \ - | ((GET_HI(from) & 0x3) << 2) \ - | (lo2 >> 6) \ - | 0x80); \ - *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ - break; \ - } \ - } \ - *fromP = from; \ - if (from < fromLim) \ - return XML_CONVERT_INPUT_INCOMPLETE; \ - else \ - return XML_CONVERT_COMPLETED; \ -} +#define DEFINE_UTF16_TO_UTF8(E) \ + static enum XML_Convert_Result PTRCALL E##toUtf8( \ + const ENCODING *enc, const char **fromP, const char *fromLim, \ + char **toP, const char *toLim) { \ + const char *from = *fromP; \ + UNUSED_P(enc); \ + fromLim = from + (((fromLim - from) >> 1) << 1); /* shrink to even */ \ + for (; from < fromLim; from += 2) { \ + int plane; \ + unsigned char lo2; \ + unsigned char lo = GET_LO(from); \ + unsigned char hi = GET_HI(from); \ + switch (hi) { \ + case 0: \ + if (lo < 0x80) { \ + if (*toP == toLim) { \ + *fromP = from; \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ + } \ + *(*toP)++ = lo; \ + break; \ + } \ + /* fall through */ \ + case 0x1: \ + case 0x2: \ + case 0x3: \ + case 0x4: \ + case 0x5: \ + case 0x6: \ + case 0x7: \ + if (toLim - *toP < 2) { \ + *fromP = from; \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ + } \ + *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ + *(*toP)++ = ((lo & 0x3f) | 0x80); \ + break; \ + default: \ + if (toLim - *toP < 3) { \ + *fromP = from; \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ + } \ + /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ + *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ + *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ + *(*toP)++ = ((lo & 0x3f) | 0x80); \ + break; \ + case 0xD8: \ + case 0xD9: \ + case 0xDA: \ + case 0xDB: \ + if (toLim - *toP < 4) { \ + *fromP = from; \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ + } \ + if (fromLim - from < 4) { \ + *fromP = from; \ + return XML_CONVERT_INPUT_INCOMPLETE; \ + } \ + plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ + *(*toP)++ = (char)((plane >> 2) | UTF8_cval4); \ + *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ + from += 2; \ + lo2 = GET_LO(from); \ + *(*toP)++ = (((lo & 0x3) << 4) | ((GET_HI(from) & 0x3) << 2) \ + | (lo2 >> 6) | 0x80); \ + *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ + break; \ + } \ + } \ + *fromP = from; \ + if (from < fromLim) \ + return XML_CONVERT_INPUT_INCOMPLETE; \ + else \ + return XML_CONVERT_COMPLETED; \ + } -#define DEFINE_UTF16_TO_UTF16(E) \ -static enum XML_Convert_Result PTRCALL \ -E ## toUtf16(const ENCODING *UNUSED_P(enc), \ - const char **fromP, const char *fromLim, \ - unsigned short **toP, const unsigned short *toLim) \ -{ \ - enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \ - fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \ - /* Avoid copying first half only of surrogate */ \ - if (fromLim - *fromP > ((toLim - *toP) << 1) \ - && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \ - fromLim -= 2; \ - res = XML_CONVERT_INPUT_INCOMPLETE; \ - } \ - for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \ - *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ - if ((*toP == toLim) && (*fromP < fromLim)) \ - return XML_CONVERT_OUTPUT_EXHAUSTED; \ - else \ - return res; \ -} +#define DEFINE_UTF16_TO_UTF16(E) \ + static enum XML_Convert_Result PTRCALL E##toUtf16( \ + const ENCODING *enc, const char **fromP, const char *fromLim, \ + unsigned short **toP, const unsigned short *toLim) { \ + enum XML_Convert_Result res = XML_CONVERT_COMPLETED; \ + UNUSED_P(enc); \ + fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */ \ + /* Avoid copying first half only of surrogate */ \ + if (fromLim - *fromP > ((toLim - *toP) << 1) \ + && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) { \ + fromLim -= 2; \ + res = XML_CONVERT_INPUT_INCOMPLETE; \ + } \ + for (; *fromP < fromLim && *toP < toLim; *fromP += 2) \ + *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ + if ((*toP == toLim) && (*fromP < fromLim)) \ + return XML_CONVERT_OUTPUT_EXHAUSTED; \ + else \ + return res; \ + } -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) +#define SET2(ptr, ch) (((ptr)[0] = ((ch)&0xff)), ((ptr)[1] = ((ch) >> 8))) #define GET_LO(ptr) ((unsigned char)(ptr)[0]) #define GET_HI(ptr) ((unsigned char)(ptr)[1]) @@ -705,8 +722,7 @@ DEFINE_UTF16_TO_UTF16(little2_) #undef GET_LO #undef GET_HI -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) +#define SET2(ptr, ch) (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch)&0xFF))) #define GET_LO(ptr) ((unsigned char)(ptr)[1]) #define GET_HI(ptr) ((unsigned char)(ptr)[0]) @@ -717,317 +733,307 @@ DEFINE_UTF16_TO_UTF16(big2_) #undef GET_LO #undef GET_HI -#define LITTLE2_BYTE_TYPE(enc, p) \ - ((p)[1] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ - : unicode_byte_type((p)[1], (p)[0])) -#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) -#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) -#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ +#define LITTLE2_BYTE_TYPE(enc, p) \ + ((p)[1] == 0 ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ + : unicode_byte_type((p)[1], (p)[0])) +#define LITTLE2_BYTE_TO_ASCII(p) ((p)[1] == 0 ? (p)[0] : -1) +#define LITTLE2_CHAR_MATCHES(p, c) ((p)[1] == 0 && (p)[0] == (c)) +#define LITTLE2_IS_NAME_CHAR_MINBPC(p) \ UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) -#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ +#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(p) \ UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) #ifdef XML_MIN_SIZE static int PTRFASTCALL -little2_byteType(const ENCODING *enc, const char *p) -{ +little2_byteType(const ENCODING *enc, const char *p) { return LITTLE2_BYTE_TYPE(enc, p); } static int PTRFASTCALL -little2_byteToAscii(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TO_ASCII(enc, p); +little2_byteToAscii(const ENCODING *enc, const char *p) { + UNUSED_P(enc); + return LITTLE2_BYTE_TO_ASCII(p); } static int PTRCALL -little2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return LITTLE2_CHAR_MATCHES(enc, p, c); +little2_charMatches(const ENCODING *enc, const char *p, int c) { + UNUSED_P(enc); + return LITTLE2_CHAR_MATCHES(p, c); } static int PTRFASTCALL -little2_isNameMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); +little2_isNameMin(const ENCODING *enc, const char *p) { + UNUSED_P(enc); + return LITTLE2_IS_NAME_CHAR_MINBPC(p); } static int PTRFASTCALL -little2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); +little2_isNmstrtMin(const ENCODING *enc, const char *p) { + UNUSED_P(enc); + return LITTLE2_IS_NMSTRT_CHAR_MINBPC(p); } -#undef VTABLE -#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 +# undef VTABLE +# define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 #else /* not XML_MIN_SIZE */ -#undef PREFIX -#define PREFIX(ident) little2_ ## ident -#define MINBPC(enc) 2 +# undef PREFIX +# define PREFIX(ident) little2_##ident +# define MINBPC(enc) 2 /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) +# define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) +# define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(p) +# define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(p, c) +# define IS_NAME_CHAR(enc, p, n) 0 +# define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(p) +# define IS_NMSTRT_CHAR(enc, p, n) (0) +# define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(p) -#define XML_TOK_IMPL_C -#include "xmltok_impl.inc" -#undef XML_TOK_IMPL_C +# define XML_TOK_IMPL_C +# include "xmltok_impl.inc" +# undef XML_TOK_IMPL_C -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR +# undef MINBPC +# undef BYTE_TYPE +# undef BYTE_TO_ASCII +# undef CHAR_MATCHES +# undef IS_NAME_CHAR +# undef IS_NAME_CHAR_MINBPC +# undef IS_NMSTRT_CHAR +# undef IS_NMSTRT_CHAR_MINBPC +# undef IS_INVALID_CHAR #endif /* not XML_MIN_SIZE */ #ifdef XML_NS -static const struct normal_encoding little2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) NULL_VTABLE -}; +static const struct normal_encoding little2_encoding_ns + = {{VTABLE, 2, 0, +# if BYTEORDER == 1234 + 1 +# else + 0 +# endif + }, + { +# include "asciitab.h" +# include "latin1tab.h" + }, + STANDARD_VTABLE(little2_) NULL_VTABLE}; #endif -static const struct normal_encoding little2_encoding = { - { VTABLE, 2, 0, +static const struct normal_encoding little2_encoding + = {{VTABLE, 2, 0, #if BYTEORDER == 1234 - 1 + 1 #else - 0 + 0 #endif - }, - { + }, + { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) NULL_VTABLE -}; + }, + STANDARD_VTABLE(little2_) NULL_VTABLE}; #if BYTEORDER != 4321 -#ifdef XML_NS +# ifdef XML_NS -static const struct normal_encoding internal_little2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) NULL_VTABLE -}; +static const struct normal_encoding internal_little2_encoding_ns + = {{VTABLE, 2, 0, 1}, + { +# include "iasciitab.h" +# include "latin1tab.h" + }, + STANDARD_VTABLE(little2_) NULL_VTABLE}; + +# endif + +static const struct normal_encoding internal_little2_encoding + = {{VTABLE, 2, 0, 1}, + { +# define BT_COLON BT_NMSTRT +# include "iasciitab.h" +# undef BT_COLON +# include "latin1tab.h" + }, + STANDARD_VTABLE(little2_) NULL_VTABLE}; #endif -static const struct normal_encoding internal_little2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) NULL_VTABLE -}; - -#endif - - -#define BIG2_BYTE_TYPE(enc, p) \ - ((p)[0] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ - : unicode_byte_type((p)[0], (p)[1])) -#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) -#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) -#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ +#define BIG2_BYTE_TYPE(enc, p) \ + ((p)[0] == 0 \ + ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ + : unicode_byte_type((p)[0], (p)[1])) +#define BIG2_BYTE_TO_ASCII(p) ((p)[0] == 0 ? (p)[1] : -1) +#define BIG2_CHAR_MATCHES(p, c) ((p)[0] == 0 && (p)[1] == (c)) +#define BIG2_IS_NAME_CHAR_MINBPC(p) \ UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) -#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ +#define BIG2_IS_NMSTRT_CHAR_MINBPC(p) \ UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) #ifdef XML_MIN_SIZE static int PTRFASTCALL -big2_byteType(const ENCODING *enc, const char *p) -{ +big2_byteType(const ENCODING *enc, const char *p) { return BIG2_BYTE_TYPE(enc, p); } static int PTRFASTCALL -big2_byteToAscii(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TO_ASCII(enc, p); +big2_byteToAscii(const ENCODING *enc, const char *p) { + UNUSED_P(enc); + return BIG2_BYTE_TO_ASCII(p); } static int PTRCALL -big2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return BIG2_CHAR_MATCHES(enc, p, c); +big2_charMatches(const ENCODING *enc, const char *p, int c) { + UNUSED_P(enc); + return BIG2_CHAR_MATCHES(p, c); } static int PTRFASTCALL -big2_isNameMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NAME_CHAR_MINBPC(enc, p); +big2_isNameMin(const ENCODING *enc, const char *p) { + UNUSED_P(enc); + return BIG2_IS_NAME_CHAR_MINBPC(p); } static int PTRFASTCALL -big2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); +big2_isNmstrtMin(const ENCODING *enc, const char *p) { + UNUSED_P(enc); + return BIG2_IS_NMSTRT_CHAR_MINBPC(p); } -#undef VTABLE -#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 +# undef VTABLE +# define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 #else /* not XML_MIN_SIZE */ -#undef PREFIX -#define PREFIX(ident) big2_ ## ident -#define MINBPC(enc) 2 +# undef PREFIX +# define PREFIX(ident) big2_##ident +# define MINBPC(enc) 2 /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) +# define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) +# define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(p) +# define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(p, c) +# define IS_NAME_CHAR(enc, p, n) 0 +# define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(p) +# define IS_NMSTRT_CHAR(enc, p, n) (0) +# define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(p) -#define XML_TOK_IMPL_C -#include "xmltok_impl.inc" -#undef XML_TOK_IMPL_C +# define XML_TOK_IMPL_C +# include "xmltok_impl.inc" +# undef XML_TOK_IMPL_C -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR +# undef MINBPC +# undef BYTE_TYPE +# undef BYTE_TO_ASCII +# undef CHAR_MATCHES +# undef IS_NAME_CHAR +# undef IS_NAME_CHAR_MINBPC +# undef IS_NMSTRT_CHAR +# undef IS_NMSTRT_CHAR_MINBPC +# undef IS_INVALID_CHAR #endif /* not XML_MIN_SIZE */ #ifdef XML_NS -static const struct normal_encoding big2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) NULL_VTABLE -}; +static const struct normal_encoding big2_encoding_ns + = {{VTABLE, 2, 0, +# if BYTEORDER == 4321 + 1 +# else + 0 +# endif + }, + { +# include "asciitab.h" +# include "latin1tab.h" + }, + STANDARD_VTABLE(big2_) NULL_VTABLE}; #endif -static const struct normal_encoding big2_encoding = { - { VTABLE, 2, 0, +static const struct normal_encoding big2_encoding + = {{VTABLE, 2, 0, #if BYTEORDER == 4321 - 1 + 1 #else - 0 + 0 #endif - }, - { + }, + { #define BT_COLON BT_NMSTRT #include "asciitab.h" #undef BT_COLON #include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) NULL_VTABLE -}; + }, + STANDARD_VTABLE(big2_) NULL_VTABLE}; #if BYTEORDER != 1234 -#ifdef XML_NS +# ifdef XML_NS -static const struct normal_encoding internal_big2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) NULL_VTABLE -}; +static const struct normal_encoding internal_big2_encoding_ns + = {{VTABLE, 2, 0, 1}, + { +# include "iasciitab.h" +# include "latin1tab.h" + }, + STANDARD_VTABLE(big2_) NULL_VTABLE}; -#endif +# endif -static const struct normal_encoding internal_big2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) NULL_VTABLE -}; +static const struct normal_encoding internal_big2_encoding + = {{VTABLE, 2, 0, 1}, + { +# define BT_COLON BT_NMSTRT +# include "iasciitab.h" +# undef BT_COLON +# include "latin1tab.h" + }, + STANDARD_VTABLE(big2_) NULL_VTABLE}; #endif #undef PREFIX static int FASTCALL -streqci(const char *s1, const char *s2) -{ +streqci(const char *s1, const char *s2) { for (;;) { char c1 = *s1++; char c2 = *s2++; if (ASCII_a <= c1 && c1 <= ASCII_z) c1 += ASCII_A - ASCII_a; if (ASCII_a <= c2 && c2 <= ASCII_z) - c2 += ASCII_A - ASCII_a; + /* The following line will never get executed. streqci() is + * only called from two places, both of which guarantee to put + * upper-case strings into s2. + */ + c2 += ASCII_A - ASCII_a; /* LCOV_EXCL_LINE */ if (c1 != c2) return 0; - if (!c1) + if (! c1) break; } return 1; } static void PTRCALL -initUpdatePosition(const ENCODING *UNUSED_P(enc), const char *ptr, - const char *end, POSITION *pos) -{ +initUpdatePosition(const ENCODING *enc, const char *ptr, const char *end, + POSITION *pos) { + UNUSED_P(enc); normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); } static int -toAscii(const ENCODING *enc, const char *ptr, const char *end) -{ +toAscii(const ENCODING *enc, const char *ptr, const char *end) { char buf[1]; char *p = buf; XmlUtf8Convert(enc, &ptr, end, &p, p + 1); @@ -1038,8 +1044,7 @@ toAscii(const ENCODING *enc, const char *ptr, const char *end) } static int FASTCALL -isSpace(int c) -{ +isSpace(int c) { switch (c) { case 0x20: case 0xD: @@ -1054,21 +1059,16 @@ isSpace(int c) followed by name=val. */ static int -parsePseudoAttribute(const ENCODING *enc, - const char *ptr, - const char *end, - const char **namePtr, - const char **nameEndPtr, - const char **valPtr, - const char **nextTokPtr) -{ +parsePseudoAttribute(const ENCODING *enc, const char *ptr, const char *end, + const char **namePtr, const char **nameEndPtr, + const char **valPtr, const char **nextTokPtr) { int c; char open; if (ptr == end) { *namePtr = NULL; return 1; } - if (!isSpace(toAscii(enc, ptr, end))) { + if (! isSpace(toAscii(enc, ptr, end))) { *nextTokPtr = ptr; return 0; } @@ -1124,12 +1124,9 @@ parsePseudoAttribute(const ENCODING *enc, c = toAscii(enc, ptr, end); if (c == open) break; - if (!(ASCII_a <= c && c <= ASCII_z) - && !(ASCII_A <= c && c <= ASCII_Z) - && !(ASCII_0 <= c && c <= ASCII_9) - && c != ASCII_PERIOD - && c != ASCII_MINUS - && c != ASCII_UNDERSCORE) { + if (! (ASCII_a <= c && c <= ASCII_z) && ! (ASCII_A <= c && c <= ASCII_Z) + && ! (ASCII_0 <= c && c <= ASCII_9) && c != ASCII_PERIOD + && c != ASCII_MINUS && c != ASCII_UNDERSCORE) { *nextTokPtr = ptr; return 0; } @@ -1138,68 +1135,52 @@ parsePseudoAttribute(const ENCODING *enc, return 1; } -static const char KW_version[] = { - ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0' -}; +static const char KW_version[] + = {ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0'}; -static const char KW_encoding[] = { - ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0' -}; +static const char KW_encoding[] = {ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, + ASCII_i, ASCII_n, ASCII_g, '\0'}; -static const char KW_standalone[] = { - ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, - ASCII_n, ASCII_e, '\0' -}; +static const char KW_standalone[] + = {ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, + ASCII_l, ASCII_o, ASCII_n, ASCII_e, '\0'}; -static const char KW_yes[] = { - ASCII_y, ASCII_e, ASCII_s, '\0' -}; +static const char KW_yes[] = {ASCII_y, ASCII_e, ASCII_s, '\0'}; -static const char KW_no[] = { - ASCII_n, ASCII_o, '\0' -}; +static const char KW_no[] = {ASCII_n, ASCII_o, '\0'}; static int -doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, - const char *, +doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, const char *, const char *), - int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ + int isGeneralTextEntity, const ENCODING *enc, const char *ptr, + const char *end, const char **badPtr, const char **versionPtr, + const char **versionEndPtr, const char **encodingName, + const ENCODING **encoding, int *standalone) { const char *val = NULL; const char *name = NULL; const char *nameEnd = NULL; ptr += 5 * enc->minBytesPerChar; end -= 2 * enc->minBytesPerChar; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) - || !name) { + if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) + || ! name) { *badPtr = ptr; return 0; } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { - if (!isGeneralTextEntity) { + if (! XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { + if (! isGeneralTextEntity) { *badPtr = name; return 0; } - } - else { + } else { if (versionPtr) *versionPtr = val; if (versionEndPtr) *versionEndPtr = ptr; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { + if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { *badPtr = ptr; return 0; } - if (!name) { + if (! name) { if (isGeneralTextEntity) { /* a TextDecl must have an EncodingDecl */ *badPtr = ptr; @@ -1210,7 +1191,7 @@ doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, } if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) { int c = toAscii(enc, val, end); - if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) { + if (! (ASCII_a <= c && c <= ASCII_z) && ! (ASCII_A <= c && c <= ASCII_Z)) { *badPtr = val; return 0; } @@ -1218,14 +1199,14 @@ doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, *encodingName = val; if (encoding) *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { + if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { *badPtr = ptr; return 0; } - if (!name) + if (! name) return 1; } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) + if (! XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) || isGeneralTextEntity) { *badPtr = name; return 0; @@ -1233,12 +1214,10 @@ doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) { if (standalone) *standalone = 1; - } - else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { + } else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { if (standalone) *standalone = 0; - } - else { + } else { *badPtr = val; return 0; } @@ -1252,11 +1231,16 @@ doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, } static int FASTCALL -checkCharRefNumber(int result) -{ +checkCharRefNumber(int result) { switch (result >> 8) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - case 0xDC: case 0xDD: case 0xDE: case 0xDF: + case 0xD8: + case 0xD9: + case 0xDA: + case 0xDB: + case 0xDC: + case 0xDD: + case 0xDE: + case 0xDF: return -1; case 0: if (latin1_encoding.type[result] == BT_NONXML) @@ -1271,8 +1255,7 @@ checkCharRefNumber(int result) } int FASTCALL -XmlUtf8Encode(int c, char *buf) -{ +XmlUtf8Encode(int c, char *buf) { enum { /* minN is minimum legal resulting value for N byte sequence */ min2 = 0x80, @@ -1281,7 +1264,7 @@ XmlUtf8Encode(int c, char *buf) }; if (c < 0) - return 0; + return 0; /* LCOV_EXCL_LINE: this case is always eliminated beforehand */ if (c < min2) { buf[0] = (char)(c | UTF8_cval1); return 1; @@ -1304,12 +1287,11 @@ XmlUtf8Encode(int c, char *buf) buf[3] = (char)((c & 0x3f) | 0x80); return 4; } - return 0; + return 0; /* LCOV_EXCL_LINE: this case too is eliminated before calling */ } int FASTCALL -XmlUtf16Encode(int charNum, unsigned short *buf) -{ +XmlUtf16Encode(int charNum, unsigned short *buf) { if (charNum < 0) return 0; if (charNum < 0x10000) { @@ -1333,17 +1315,15 @@ struct unknown_encoding { char utf8[256][4]; }; -#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *) (enc)) +#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *)(enc)) int -XmlSizeOfUnknownEncoding(void) -{ +XmlSizeOfUnknownEncoding(void) { return sizeof(struct unknown_encoding); } static int PTRFASTCALL -unknown_isName(const ENCODING *enc, const char *p) -{ +unknown_isName(const ENCODING *enc, const char *p) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); int c = uenc->convert(uenc->userData, p); if (c & ~0xFFFF) @@ -1352,8 +1332,7 @@ unknown_isName(const ENCODING *enc, const char *p) } static int PTRFASTCALL -unknown_isNmstrt(const ENCODING *enc, const char *p) -{ +unknown_isNmstrt(const ENCODING *enc, const char *p) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); int c = uenc->convert(uenc->userData, p); if (c & ~0xFFFF) @@ -1362,18 +1341,15 @@ unknown_isNmstrt(const ENCODING *enc, const char *p) } static int PTRFASTCALL -unknown_isInvalid(const ENCODING *enc, const char *p) -{ +unknown_isInvalid(const ENCODING *enc, const char *p) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); int c = uenc->convert(uenc->userData, p); return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; } static enum XML_Convert_Result PTRCALL -unknown_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ +unknown_toUtf8(const ENCODING *enc, const char **fromP, const char *fromLim, + char **toP, const char *toLim) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); char buf[XML_UTF8_ENCODE_MAX]; for (;;) { @@ -1391,33 +1367,27 @@ unknown_toUtf8(const ENCODING *enc, utf8 = buf; *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - (BT_LEAD2 - 2)); - } - else { + } else { if (n > toLim - *toP) return XML_CONVERT_OUTPUT_EXHAUSTED; (*fromP)++; } - do { - *(*toP)++ = *utf8++; - } while (--n != 0); + memcpy(*toP, utf8, n); + *toP += n; } } static enum XML_Convert_Result PTRCALL -unknown_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ +unknown_toUtf16(const ENCODING *enc, const char **fromP, const char *fromLim, + unsigned short **toP, const unsigned short *toLim) { const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); while (*fromP < fromLim && *toP < toLim) { unsigned short c = uenc->utf16[(unsigned char)**fromP]; if (c == 0) { - c = (unsigned short) - uenc->convert(uenc->userData, *fromP); + c = (unsigned short)uenc->convert(uenc->userData, *fromP); *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - (BT_LEAD2 - 2)); - } - else + } else (*fromP)++; *(*toP)++ = c; } @@ -1429,19 +1399,14 @@ unknown_toUtf16(const ENCODING *enc, } ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - CONVERTER convert, - void *userData) -{ +XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, + void *userData) { int i; struct unknown_encoding *e = (struct unknown_encoding *)mem; - for (i = 0; i < (int)sizeof(struct normal_encoding); i++) - ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; + memcpy(mem, &latin1_encoding, sizeof(struct normal_encoding)); for (i = 0; i < 128; i++) if (latin1_encoding.type[i] != BT_OTHER - && latin1_encoding.type[i] != BT_NONXML - && table[i] != i) + && latin1_encoding.type[i] != BT_NONXML && table[i] != i) return 0; for (i = 0; i < 256; i++) { int c = table[i]; @@ -1451,32 +1416,30 @@ XmlInitUnknownEncoding(void *mem, e->utf16[i] = 0xFFFF; e->utf8[i][0] = 1; e->utf8[i][1] = 0; - } - else if (c < 0) { + } else if (c < 0) { if (c < -4) return 0; + /* Multi-byte sequences need a converter function */ + if (! convert) + return 0; e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); e->utf8[i][0] = 0; e->utf16[i] = 0; - } - else if (c < 0x80) { + } else if (c < 0x80) { if (latin1_encoding.type[c] != BT_OTHER - && latin1_encoding.type[c] != BT_NONXML - && c != i) + && latin1_encoding.type[c] != BT_NONXML && c != i) return 0; e->normal.type[i] = latin1_encoding.type[c]; e->utf8[i][0] = 1; e->utf8[i][1] = (char)c; e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c); - } - else if (checkCharRefNumber(c) < 0) { + } else if (checkCharRefNumber(c) < 0) { e->normal.type[i] = BT_NONXML; /* This shouldn't really get used. */ e->utf16[i] = 0xFFFF; e->utf8[i][0] = 1; e->utf8[i][1] = 0; - } - else { + } else { if (c > 0xFFFF) return 0; if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) @@ -1521,44 +1484,32 @@ enum { NO_ENC }; -static const char KW_ISO_8859_1[] = { - ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, - ASCII_MINUS, ASCII_1, '\0' -}; -static const char KW_US_ASCII[] = { - ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, - '\0' -}; -static const char KW_UTF_8[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0' -}; -static const char KW_UTF_16[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0' -}; -static const char KW_UTF_16BE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, - '\0' -}; -static const char KW_UTF_16LE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, - '\0' -}; +static const char KW_ISO_8859_1[] + = {ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, + ASCII_5, ASCII_9, ASCII_MINUS, ASCII_1, '\0'}; +static const char KW_US_ASCII[] + = {ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, + ASCII_C, ASCII_I, ASCII_I, '\0'}; +static const char KW_UTF_8[] + = {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0'}; +static const char KW_UTF_16[] + = {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0'}; +static const char KW_UTF_16BE[] + = {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, + ASCII_6, ASCII_B, ASCII_E, '\0'}; +static const char KW_UTF_16LE[] + = {ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, + ASCII_6, ASCII_L, ASCII_E, '\0'}; static int FASTCALL -getEncodingIndex(const char *name) -{ - static const char * const encodingNames[] = { - KW_ISO_8859_1, - KW_US_ASCII, - KW_UTF_8, - KW_UTF_16, - KW_UTF_16BE, - KW_UTF_16LE, +getEncodingIndex(const char *name) { + static const char *const encodingNames[] = { + KW_ISO_8859_1, KW_US_ASCII, KW_UTF_8, KW_UTF_16, KW_UTF_16BE, KW_UTF_16LE, }; int i; if (name == NULL) return NO_ENC; - for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++) + for (i = 0; i < (int)(sizeof(encodingNames) / sizeof(encodingNames[0])); i++) if (streqci(name, encodingNames[i])) return i; return UNKNOWN_ENC; @@ -1578,15 +1529,9 @@ getEncodingIndex(const char *name) XML_PROLOG_STATE otherwise. */ - static int -initScan(const ENCODING * const *encodingTable, - const INIT_ENCODING *enc, - int state, - const char *ptr, - const char *end, - const char **nextTokPtr) -{ +initScan(const ENCODING *const *encodingTable, const INIT_ENCODING *enc, + int state, const char *ptr, const char *end, const char **nextTokPtr) { const ENCODING **encPtr; if (ptr >= end) @@ -1611,20 +1556,17 @@ initScan(const ENCODING * const *encodingTable, case 0xFE: case 0xFF: case 0xEF: /* possibly first byte of UTF-8 BOM */ - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) + if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; /* fall through */ case 0x00: case 0x3C: return XML_TOK_PARTIAL; } - } - else { + } else { switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { case 0xFEFF: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) + if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; *nextTokPtr = ptr + 2; *encPtr = encodingTable[UTF_16BE_ENC]; @@ -1638,8 +1580,7 @@ initScan(const ENCODING * const *encodingTable, *encPtr = encodingTable[UTF_16LE_ENC]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); case 0xFFFE: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) + if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC && state == XML_CONTENT_STATE) break; *nextTokPtr = ptr + 2; *encPtr = encodingTable[UTF_16LE_ENC]; @@ -1654,8 +1595,8 @@ initScan(const ENCODING * const *encodingTable, */ if (state == XML_CONTENT_STATE) { int e = INIT_ENC_INDEX(enc); - if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC - || e == UTF_16LE_ENC || e == UTF_16_ENC) + if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC || e == UTF_16LE_ENC + || e == UTF_16_ENC) break; } if (ptr + 2 == end) @@ -1678,8 +1619,7 @@ initScan(const ENCODING * const *encodingTable, break; *encPtr = encodingTable[UTF_16BE_ENC]; return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - else if (ptr[1] == '\0') { + } else if (ptr[1] == '\0') { /* We could recover here in the case: - parsing an external entity - second byte is 0 @@ -1701,7 +1641,6 @@ initScan(const ENCODING * const *encodingTable, return XmlTok(*encPtr, state, ptr, end, nextTokPtr); } - #define NS(x) x #define ns(x) x #define XML_TOK_NS_C @@ -1712,22 +1651,19 @@ initScan(const ENCODING * const *encodingTable, #ifdef XML_NS -#define NS(x) x ## NS -#define ns(x) x ## _ns +# define NS(x) x##NS +# define ns(x) x##_ns -#define XML_TOK_NS_C -#include "xmltok_ns.inc" -#undef XML_TOK_NS_C +# define XML_TOK_NS_C +# include "xmltok_ns.inc" +# undef XML_TOK_NS_C -#undef NS -#undef ns +# undef NS +# undef ns ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - CONVERTER convert, - void *userData) -{ +XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert, + void *userData) { ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); if (enc) ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON; diff --git a/deps/EXPAT/expat/xmltok.h b/deps/EXPAT/expat/xmltok.h index 752007e8b..6f630c2f9 100644 --- a/deps/EXPAT/expat/xmltok.h +++ b/deps/EXPAT/expat/xmltok.h @@ -1,5 +1,37 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2002-2005 Karl Waclawek + Copyright (c) 2016-2017 Sebastian Pipping + Copyright (c) 2017 Rhodri James + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef XmlTok_INCLUDED @@ -10,16 +42,18 @@ extern "C" { #endif /* The following token may be returned by XmlContentTok */ -#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be - start of illegal ]]> sequence */ +#define XML_TOK_TRAILING_RSQB \ + -5 /* ] or ]] at the end of the scan; might be \ + start of illegal ]]> sequence */ /* The following tokens may be returned by both XmlPrologTok and XmlContentTok. */ -#define XML_TOK_NONE -4 /* The string to be scanned is empty */ -#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; - might be part of CRLF sequence */ -#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ -#define XML_TOK_PARTIAL -1 /* only part of a token */ +#define XML_TOK_NONE -4 /* The string to be scanned is empty */ +#define XML_TOK_TRAILING_CR \ + -3 /* A CR at the end of the scan; \ + might be part of CRLF sequence */ +#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ +#define XML_TOK_PARTIAL -1 /* only part of a token */ #define XML_TOK_INVALID 0 /* The following tokens are returned by XmlContentTok; some are also @@ -34,24 +68,24 @@ extern "C" { #define XML_TOK_DATA_NEWLINE 7 #define XML_TOK_CDATA_SECT_OPEN 8 #define XML_TOK_ENTITY_REF 9 -#define XML_TOK_CHAR_REF 10 /* numeric character reference */ +#define XML_TOK_CHAR_REF 10 /* numeric character reference */ /* The following tokens may be returned by both XmlPrologTok and XmlContentTok. */ -#define XML_TOK_PI 11 /* processing instruction */ -#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ +#define XML_TOK_PI 11 /* processing instruction */ +#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ #define XML_TOK_COMMENT 13 -#define XML_TOK_BOM 14 /* Byte order mark */ +#define XML_TOK_BOM 14 /* Byte order mark */ /* The following tokens are returned only by XmlPrologTok */ #define XML_TOK_PROLOG_S 15 -#define XML_TOK_DECL_OPEN 16 /* */ +#define XML_TOK_DECL_OPEN 16 /* */ #define XML_TOK_NAME 18 #define XML_TOK_NMTOKEN 19 -#define XML_TOK_POUND_NAME 20 /* #name */ -#define XML_TOK_OR 21 /* | */ +#define XML_TOK_POUND_NAME 20 /* #name */ +#define XML_TOK_OR 21 /* | */ #define XML_TOK_PERCENT 22 #define XML_TOK_OPEN_PAREN 23 #define XML_TOK_CLOSE_PAREN 24 @@ -62,14 +96,14 @@ extern "C" { #define XML_TOK_INSTANCE_START 29 /* The following occur only in element type declarations */ -#define XML_TOK_NAME_QUESTION 30 /* name? */ -#define XML_TOK_NAME_ASTERISK 31 /* name* */ -#define XML_TOK_NAME_PLUS 32 /* name+ */ -#define XML_TOK_COND_SECT_OPEN 33 /* */ -#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ -#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ -#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ +#define XML_TOK_NAME_QUESTION 30 /* name? */ +#define XML_TOK_NAME_ASTERISK 31 /* name* */ +#define XML_TOK_NAME_PLUS 32 /* name+ */ +#define XML_TOK_COND_SECT_OPEN 33 /* */ +#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ +#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ +#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ #define XML_TOK_COMMA 38 /* The following token is returned only by XmlAttributeValueTok */ @@ -84,20 +118,20 @@ extern "C" { #define XML_TOK_PREFIXED_NAME 41 #ifdef XML_DTD -#define XML_TOK_IGNORE_SECT 42 +# define XML_TOK_IGNORE_SECT 42 #endif /* XML_DTD */ #ifdef XML_DTD -#define XML_N_STATES 4 +# define XML_N_STATES 4 #else /* not XML_DTD */ -#define XML_N_STATES 3 +# define XML_N_STATES 3 #endif /* not XML_DTD */ #define XML_PROLOG_STATE 0 #define XML_CONTENT_STATE 1 #define XML_CDATA_SECTION_STATE 2 #ifdef XML_DTD -#define XML_IGNORE_SECTION_STATE 3 +# define XML_IGNORE_SECTION_STATE 3 #endif /* XML_DTD */ #define XML_N_LITERAL_TYPES 2 @@ -125,55 +159,41 @@ typedef struct { struct encoding; typedef struct encoding ENCODING; -typedef int (PTRCALL *SCANNER)(const ENCODING *, - const char *, - const char *, - const char **); +typedef int(PTRCALL *SCANNER)(const ENCODING *, const char *, const char *, + const char **); enum XML_Convert_Result { XML_CONVERT_COMPLETED = 0, XML_CONVERT_INPUT_INCOMPLETE = 1, - XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */ + XML_CONVERT_OUTPUT_EXHAUSTED + = 2 /* and therefore potentially input remaining as well */ }; struct encoding { SCANNER scanners[XML_N_STATES]; SCANNER literalScanners[XML_N_LITERAL_TYPES]; - int (PTRCALL *sameName)(const ENCODING *, - const char *, - const char *); - int (PTRCALL *nameMatchesAscii)(const ENCODING *, - const char *, - const char *, - const char *); - int (PTRFASTCALL *nameLength)(const ENCODING *, const char *); + int(PTRCALL *nameMatchesAscii)(const ENCODING *, const char *, const char *, + const char *); + int(PTRFASTCALL *nameLength)(const ENCODING *, const char *); const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); - int (PTRCALL *getAtts)(const ENCODING *enc, - const char *ptr, - int attsMax, - ATTRIBUTE *atts); - int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); - int (PTRCALL *predefinedEntityName)(const ENCODING *, - const char *, - const char *); - void (PTRCALL *updatePosition)(const ENCODING *, - const char *ptr, - const char *end, - POSITION *); - int (PTRCALL *isPublicId)(const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr); - enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - char **toP, - const char *toLim); - enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - unsigned short **toP, - const unsigned short *toLim); + int(PTRCALL *getAtts)(const ENCODING *enc, const char *ptr, int attsMax, + ATTRIBUTE *atts); + int(PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); + int(PTRCALL *predefinedEntityName)(const ENCODING *, const char *, + const char *); + void(PTRCALL *updatePosition)(const ENCODING *, const char *ptr, + const char *end, POSITION *); + int(PTRCALL *isPublicId)(const ENCODING *enc, const char *ptr, + const char *end, const char **badPtr); + enum XML_Convert_Result(PTRCALL *utf8Convert)(const ENCODING *enc, + const char **fromP, + const char *fromLim, char **toP, + const char *toLim); + enum XML_Convert_Result(PTRCALL *utf16Convert)(const ENCODING *enc, + const char **fromP, + const char *fromLim, + unsigned short **toP, + const unsigned short *toLim); int minBytesPerChar; char isUtf8; char isUtf16; @@ -200,68 +220,62 @@ struct encoding { the prolog outside literals, comments and processing instructions. */ - -#define XmlTok(enc, state, ptr, end, nextTokPtr) \ +#define XmlTok(enc, state, ptr, end, nextTokPtr) \ (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) -#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) +#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) -#define XmlContentTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) +#define XmlContentTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) -#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) +#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) #ifdef XML_DTD -#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) +# define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ + XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) #endif /* XML_DTD */ /* This is used for performing a 2nd-level tokenization on the content of a literal that has already been returned by XmlTok. */ -#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ +#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) -#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) +#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ + XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) -#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) +#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ + XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) -#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) - -#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ +#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) -#define XmlNameLength(enc, ptr) \ - (((enc)->nameLength)(enc, ptr)) +#define XmlNameLength(enc, ptr) (((enc)->nameLength)(enc, ptr)) -#define XmlSkipS(enc, ptr) \ - (((enc)->skipS)(enc, ptr)) +#define XmlSkipS(enc, ptr) (((enc)->skipS)(enc, ptr)) -#define XmlGetAttributes(enc, ptr, attsMax, atts) \ +#define XmlGetAttributes(enc, ptr, attsMax, atts) \ (((enc)->getAtts)(enc, ptr, attsMax, atts)) -#define XmlCharRefNumber(enc, ptr) \ - (((enc)->charRefNumber)(enc, ptr)) +#define XmlCharRefNumber(enc, ptr) (((enc)->charRefNumber)(enc, ptr)) -#define XmlPredefinedEntityName(enc, ptr, end) \ +#define XmlPredefinedEntityName(enc, ptr, end) \ (((enc)->predefinedEntityName)(enc, ptr, end)) -#define XmlUpdatePosition(enc, ptr, end, pos) \ +#define XmlUpdatePosition(enc, ptr, end, pos) \ (((enc)->updatePosition)(enc, ptr, end, pos)) -#define XmlIsPublicId(enc, ptr, end, badPtr) \ +#define XmlIsPublicId(enc, ptr, end, badPtr) \ (((enc)->isPublicId)(enc, ptr, end, badPtr)) -#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ +#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) -#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ +#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) typedef struct { @@ -269,16 +283,11 @@ typedef struct { const ENCODING **encPtr; } INIT_ENCODING; -int XmlParseXmlDecl(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, +int XmlParseXmlDecl(int isGeneralTextEntity, const ENCODING *enc, + const char *ptr, const char *end, const char **badPtr, + const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); + const ENCODING **namedEncodingPtr, int *standalonePtr); int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); const ENCODING *XmlGetUtf8InternalEncoding(void); @@ -287,34 +296,22 @@ int FASTCALL XmlUtf8Encode(int charNumber, char *buf); int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); int XmlSizeOfUnknownEncoding(void); +typedef int(XMLCALL *CONVERTER)(void *userData, const char *p); -typedef int (XMLCALL *CONVERTER) (void *userData, const char *p); +ENCODING *XmlInitUnknownEncoding(void *mem, int *table, CONVERTER convert, + void *userData); -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - CONVERTER convert, - void *userData); - -int XmlParseXmlDeclNS(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, +int XmlParseXmlDeclNS(int isGeneralTextEntity, const ENCODING *enc, + const char *ptr, const char *end, const char **badPtr, + const char **versionPtr, const char **versionEndPtr, const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); + const ENCODING **namedEncodingPtr, int *standalonePtr); int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); const ENCODING *XmlGetUtf8InternalEncodingNS(void); const ENCODING *XmlGetUtf16InternalEncodingNS(void); -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - CONVERTER convert, - void *userData); +ENCODING *XmlInitUnknownEncodingNS(void *mem, int *table, CONVERTER convert, + void *userData); #ifdef __cplusplus } #endif diff --git a/deps/EXPAT/expat/xmltok_impl.h b/deps/EXPAT/expat/xmltok_impl.h index da0ea60a6..3469c4ae1 100644 --- a/deps/EXPAT/expat/xmltok_impl.h +++ b/deps/EXPAT/expat/xmltok_impl.h @@ -1,46 +1,74 @@ /* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2017-2019 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ enum { - BT_NONXML, - BT_MALFORM, - BT_LT, - BT_AMP, - BT_RSQB, - BT_LEAD2, - BT_LEAD3, - BT_LEAD4, - BT_TRAIL, - BT_CR, - BT_LF, - BT_GT, - BT_QUOT, - BT_APOS, - BT_EQUALS, - BT_QUEST, - BT_EXCL, - BT_SOL, - BT_SEMI, - BT_NUM, - BT_LSQB, - BT_S, - BT_NMSTRT, - BT_COLON, - BT_HEX, - BT_DIGIT, - BT_NAME, - BT_MINUS, - BT_OTHER, /* known not to be a name or name start character */ + BT_NONXML, /* e.g. noncharacter-FFFF */ + BT_MALFORM, /* illegal, with regard to encoding */ + BT_LT, /* less than = "<" */ + BT_AMP, /* ampersand = "&" */ + BT_RSQB, /* right square bracket = "[" */ + BT_LEAD2, /* lead byte of a 2-byte UTF-8 character */ + BT_LEAD3, /* lead byte of a 3-byte UTF-8 character */ + BT_LEAD4, /* lead byte of a 4-byte UTF-8 character */ + BT_TRAIL, /* trailing unit, e.g. second 16-bit unit of a 4-byte char. */ + BT_CR, /* carriage return = "\r" */ + BT_LF, /* line feed = "\n" */ + BT_GT, /* greater than = ">" */ + BT_QUOT, /* quotation character = "\"" */ + BT_APOS, /* apostrophe = "'" */ + BT_EQUALS, /* equal sign = "=" */ + BT_QUEST, /* question mark = "?" */ + BT_EXCL, /* exclamation mark = "!" */ + BT_SOL, /* solidus, slash = "/" */ + BT_SEMI, /* semicolon = ";" */ + BT_NUM, /* number sign = "#" */ + BT_LSQB, /* left square bracket = "[" */ + BT_S, /* white space, e.g. "\t", " "[, "\r"] */ + BT_NMSTRT, /* non-hex name start letter = "G".."Z" + "g".."z" + "_" */ + BT_COLON, /* colon = ":" */ + BT_HEX, /* hex letter = "A".."F" + "a".."f" */ + BT_DIGIT, /* digit = "0".."9" */ + BT_NAME, /* dot and middle dot = "." + chr(0xb7) */ + BT_MINUS, /* minus = "-" */ + BT_OTHER, /* known not to be a name or name start character */ BT_NONASCII, /* might be a name or name start character */ - BT_PERCNT, - BT_LPAR, - BT_RPAR, - BT_AST, - BT_PLUS, - BT_COMMA, - BT_VERBAR + BT_PERCNT, /* percent sign = "%" */ + BT_LPAR, /* left parenthesis = "(" */ + BT_RPAR, /* right parenthesis = "(" */ + BT_AST, /* asterisk = "*" */ + BT_PLUS, /* plus sign = "+" */ + BT_COMMA, /* comma = "," */ + BT_VERBAR /* vertical bar = "|" */ }; #include diff --git a/deps/EXPAT/expat/xmltok_impl.inc b/deps/EXPAT/expat/xmltok_impl.inc index 5f779c057..1971d74bf 100644 --- a/deps/EXPAT/expat/xmltok_impl.inc +++ b/deps/EXPAT/expat/xmltok_impl.inc @@ -1,132 +1,165 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included (from xmltok.c, 1-3 times depending on XML_MIN_SIZE)! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2002-2016 Karl Waclawek + Copyright (c) 2016-2022 Sebastian Pipping + Copyright (c) 2017 Rhodri James + Copyright (c) 2018 Benjamin Peterson + Copyright (c) 2018 Anton Maklakov + Copyright (c) 2019 David Loffredo + Copyright (c) 2020 Boris Kolpackov + Copyright (c) 2022 Martin Ettl + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_IMPL_C -#ifndef IS_INVALID_CHAR -#define IS_INVALID_CHAR(enc, ptr, n) (0) -#endif +# ifndef IS_INVALID_CHAR // i.e. for UTF-16 and XML_MIN_SIZE not defined +# define IS_INVALID_CHAR(enc, ptr, n) (0) +# endif -#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_INVALID_CHAR(enc, ptr, n)) { \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; +# define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ + case BT_LEAD##n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (IS_INVALID_CHAR(enc, ptr, n)) { \ + *(nextTokPtr) = (ptr); \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; -#define INVALID_CASES(ptr, nextTokPtr) \ - INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ - case BT_NONXML: \ - case BT_MALFORM: \ - case BT_TRAIL: \ - *(nextTokPtr) = (ptr); \ +# define INVALID_CASES(ptr, nextTokPtr) \ + INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ + INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ + INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ + case BT_NONXML: \ + case BT_MALFORM: \ + case BT_TRAIL: \ + *(nextTokPtr) = (ptr); \ return XML_TOK_INVALID; -#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NAME_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; +# define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ + case BT_LEAD##n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (IS_INVALID_CHAR(enc, ptr, n) || ! IS_NAME_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; -#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - case BT_DIGIT: \ - case BT_NAME: \ - case BT_MINUS: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) +# define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ + case BT_NONASCII: \ + if (! IS_NAME_CHAR_MINBPC(enc, ptr)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + /* fall through */ \ + case BT_NMSTRT: \ + case BT_HEX: \ + case BT_DIGIT: \ + case BT_NAME: \ + case BT_MINUS: \ + ptr += MINBPC(enc); \ + break; \ + CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ + CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ + CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) -#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; +# define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ + case BT_LEAD##n: \ + if ((end) - (ptr) < (n)) \ + return XML_TOK_PARTIAL_CHAR; \ + if (IS_INVALID_CHAR(enc, ptr, n) || ! IS_NMSTRT_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + ptr += n; \ + break; -#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) +# define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ + case BT_NONASCII: \ + if (! IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + /* fall through */ \ + case BT_NMSTRT: \ + case BT_HEX: \ + ptr += MINBPC(enc); \ + break; \ + CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ + CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ + CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) -#ifndef PREFIX -#define PREFIX(ident) ident -#endif +# ifndef PREFIX +# define PREFIX(ident) ident +# endif +# define HAS_CHARS(enc, ptr, end, count) \ + ((end) - (ptr) >= ((count)*MINBPC(enc))) -#define HAS_CHARS(enc, ptr, end, count) \ - (end - ptr >= count * MINBPC(enc)) +# define HAS_CHAR(enc, ptr, end) HAS_CHARS(enc, ptr, end, 1) -#define HAS_CHAR(enc, ptr, end) \ - HAS_CHARS(enc, ptr, end, 1) - -#define REQUIRE_CHARS(enc, ptr, end, count) \ - { \ - if (! HAS_CHARS(enc, ptr, end, count)) { \ - return XML_TOK_PARTIAL; \ - } \ +# define REQUIRE_CHARS(enc, ptr, end, count) \ + { \ + if (! HAS_CHARS(enc, ptr, end, count)) { \ + return XML_TOK_PARTIAL; \ + } \ } -#define REQUIRE_CHAR(enc, ptr, end) \ - REQUIRE_CHARS(enc, ptr, end, 1) - +# define REQUIRE_CHAR(enc, ptr, end) REQUIRE_CHARS(enc, ptr, end, 1) /* ptr points to character following " */ switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { - case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: + case BT_S: + case BT_CR: + case BT_LF: + case BT_PERCNT: *nextTokPtr = ptr; return XML_TOK_INVALID; } /* fall through */ - case BT_S: case BT_CR: case BT_LF: + case BT_S: + case BT_CR: + case BT_LF: *nextTokPtr = ptr; return XML_TOK_DECL_OPEN; case BT_NMSTRT: @@ -191,12 +228,12 @@ PREFIX(scanDecl)(const ENCODING *enc, const char *ptr, } static int PTRCALL -PREFIX(checkPiTarget)(const ENCODING *UNUSED_P(enc), const char *ptr, - const char *end, int *tokPtr) -{ +PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, + int *tokPtr) { int upper = 0; + UNUSED_P(enc); *tokPtr = XML_TOK_PI; - if (end - ptr != MINBPC(enc)*3) + if (end - ptr != MINBPC(enc) * 3) return 1; switch (BYTE_TO_ASCII(enc, ptr)) { case ASCII_x: @@ -236,30 +273,31 @@ PREFIX(checkPiTarget)(const ENCODING *UNUSED_P(enc), const char *ptr, /* ptr points to character following "= end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { @@ -332,11 +369,11 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, case BT_RSQB: ptr += MINBPC(enc); REQUIRE_CHAR(enc, ptr, end); - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) + if (! CHAR_MATCHES(enc, ptr, ASCII_RSQB)) break; ptr += MINBPC(enc); REQUIRE_CHAR(enc, ptr, end); - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { + if (! CHAR_MATCHES(enc, ptr, ASCII_GT)) { ptr -= MINBPC(enc); break; } @@ -352,23 +389,25 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, case BT_LF: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_DATA_NEWLINE; - INVALID_CASES(ptr, nextTokPtr) + INVALID_CASES(ptr, nextTokPtr) default: ptr += MINBPC(enc); break; } while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE +# define LEAD_CASE(n) \ + case BT_LEAD##n: \ + if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_DATA_CHARS; \ + } \ + ptr += n; \ + break; + LEAD_CASE(2) + LEAD_CASE(3) + LEAD_CASE(4) +# undef LEAD_CASE case BT_NONXML: case BT_MALFORM: case BT_TRAIL: @@ -389,23 +428,26 @@ PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, /* ptr points to character following "= end) return XML_TOK_NONE; if (MINBPC(enc) > 1) { @@ -813,48 +853,50 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, ptr += MINBPC(enc); if (! HAS_CHAR(enc, ptr, end)) return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) + if (! CHAR_MATCHES(enc, ptr, ASCII_RSQB)) break; ptr += MINBPC(enc); if (! HAS_CHAR(enc, ptr, end)) return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { + if (! CHAR_MATCHES(enc, ptr, ASCII_GT)) { ptr -= MINBPC(enc); break; } *nextTokPtr = ptr; return XML_TOK_INVALID; - INVALID_CASES(ptr, nextTokPtr) + INVALID_CASES(ptr, nextTokPtr) default: ptr += MINBPC(enc); break; } while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE +# define LEAD_CASE(n) \ + case BT_LEAD##n: \ + if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_DATA_CHARS; \ + } \ + ptr += n; \ + break; + LEAD_CASE(2) + LEAD_CASE(3) + LEAD_CASE(4) +# undef LEAD_CASE case BT_RSQB: if (HAS_CHARS(enc, ptr, end, 2)) { - if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { - ptr += MINBPC(enc); - break; - } - if (HAS_CHARS(enc, ptr, end, 3)) { - if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { - ptr += MINBPC(enc); - break; - } - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_INVALID; - } + if (! CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { + ptr += MINBPC(enc); + break; + } + if (HAS_CHARS(enc, ptr, end, 3)) { + if (! CHAR_MATCHES(enc, ptr + 2 * MINBPC(enc), ASCII_GT)) { + ptr += MINBPC(enc); + break; + } + *nextTokPtr = ptr + 2 * MINBPC(enc); + return XML_TOK_INVALID; + } } /* fall through */ case BT_AMP: @@ -879,12 +921,14 @@ PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end, static int PTRCALL PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ + const char **nextTokPtr) { REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + case BT_S: + case BT_LF: + case BT_CR: + case BT_PERCNT: *nextTokPtr = ptr; return XML_TOK_PERCENT; default: @@ -893,7 +937,7 @@ PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, } while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) case BT_SEMI: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_PARAM_ENTITY_REF; @@ -907,20 +951,24 @@ PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, static int PTRCALL PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ + const char **nextTokPtr) { REQUIRE_CHAR(enc, ptr, end); switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) + CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) default: *nextTokPtr = ptr; return XML_TOK_INVALID; } while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_CR: case BT_LF: case BT_S: - case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_CR: + case BT_LF: + case BT_S: + case BT_RPAR: + case BT_GT: + case BT_PERCNT: + case BT_VERBAR: *nextTokPtr = ptr; return XML_TOK_POUND_NAME; default: @@ -932,14 +980,12 @@ PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, } static int PTRCALL -PREFIX(scanLit)(int open, const ENCODING *enc, - const char *ptr, const char *end, - const char **nextTokPtr) -{ +PREFIX(scanLit)(int open, const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) { while (HAS_CHAR(enc, ptr, end)) { int t = BYTE_TYPE(enc, ptr); switch (t) { - INVALID_CASES(ptr, nextTokPtr) + INVALID_CASES(ptr, nextTokPtr) case BT_QUOT: case BT_APOS: ptr += MINBPC(enc); @@ -949,8 +995,12 @@ PREFIX(scanLit)(int open, const ENCODING *enc, return -XML_TOK_LITERAL; *nextTokPtr = ptr; switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_CR: case BT_LF: - case BT_GT: case BT_PERCNT: case BT_LSQB: + case BT_S: + case BT_CR: + case BT_LF: + case BT_GT: + case BT_PERCNT: + case BT_LSQB: return XML_TOK_LITERAL; default: return XML_TOK_INVALID; @@ -965,8 +1015,7 @@ PREFIX(scanLit)(int open, const ENCODING *enc, static int PTRCALL PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ + const char **nextTokPtr) { int tok; if (ptr >= end) return XML_TOK_NONE; @@ -984,27 +1033,26 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); case BT_APOS: return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_LT: - { - ptr += MINBPC(enc); - REQUIRE_CHAR(enc, ptr, end); - switch (BYTE_TYPE(enc, ptr)) { - case BT_EXCL: - return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_QUEST: - return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_NMSTRT: - case BT_HEX: - case BT_NONASCII: - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - *nextTokPtr = ptr - MINBPC(enc); - return XML_TOK_INSTANCE_START; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; + case BT_LT: { + ptr += MINBPC(enc); + REQUIRE_CHAR(enc, ptr, end); + switch (BYTE_TYPE(enc, ptr)) { + case BT_EXCL: + return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_QUEST: + return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); + case BT_NMSTRT: + case BT_HEX: + case BT_NONASCII: + case BT_LEAD2: + case BT_LEAD3: + case BT_LEAD4: + *nextTokPtr = ptr - MINBPC(enc); + return XML_TOK_INSTANCE_START; } + *nextTokPtr = ptr; + return XML_TOK_INVALID; + } case BT_CR: if (ptr + MINBPC(enc) == end) { *nextTokPtr = end; @@ -1012,13 +1060,15 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, return -XML_TOK_PROLOG_S; } /* fall through */ - case BT_S: case BT_LF: + case BT_S: + case BT_LF: for (;;) { ptr += MINBPC(enc); if (! HAS_CHAR(enc, ptr, end)) break; switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_LF: + case BT_S: + case BT_LF: break; case BT_CR: /* don't split CR/LF pair */ @@ -1047,7 +1097,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { REQUIRE_CHARS(enc, ptr, end, 2); if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { - *nextTokPtr = ptr + 2*MINBPC(enc); + *nextTokPtr = ptr + 2 * MINBPC(enc); return XML_TOK_COND_SECT_CLOSE; } } @@ -1070,8 +1120,12 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, case BT_PLUS: *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_CLOSE_PAREN_PLUS; - case BT_CR: case BT_LF: case BT_S: - case BT_GT: case BT_COMMA: case BT_VERBAR: + case BT_CR: + case BT_LF: + case BT_S: + case BT_GT: + case BT_COMMA: + case BT_VERBAR: case BT_RPAR: *nextTokPtr = ptr; return XML_TOK_CLOSE_PAREN; @@ -1086,24 +1140,30 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, return XML_TOK_DECL_CLOSE; case BT_NUM: return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NAME; \ - break; \ - } \ - if (IS_NAME_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NMTOKEN; \ - break; \ - } \ - *nextTokPtr = ptr; \ +# define LEAD_CASE(n) \ + case BT_LEAD##n: \ + if (end - ptr < n) \ + return XML_TOK_PARTIAL_CHAR; \ + if (IS_INVALID_CHAR(enc, ptr, n)) { \ + *nextTokPtr = ptr; \ + return XML_TOK_INVALID; \ + } \ + if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ + ptr += n; \ + tok = XML_TOK_NAME; \ + break; \ + } \ + if (IS_NAME_CHAR(enc, ptr, n)) { \ + ptr += n; \ + tok = XML_TOK_NMTOKEN; \ + break; \ + } \ + *nextTokPtr = ptr; \ return XML_TOK_INVALID; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE + LEAD_CASE(2) + LEAD_CASE(3) + LEAD_CASE(4) +# undef LEAD_CASE case BT_NMSTRT: case BT_HEX: tok = XML_TOK_NAME; @@ -1112,9 +1172,9 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, case BT_DIGIT: case BT_NAME: case BT_MINUS: -#ifdef XML_NS +# ifdef XML_NS case BT_COLON: -#endif +# endif tok = XML_TOK_NMTOKEN; ptr += MINBPC(enc); break; @@ -1136,13 +1196,19 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, } while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_GT: case BT_RPAR: case BT_COMMA: - case BT_VERBAR: case BT_LSQB: case BT_PERCNT: - case BT_S: case BT_CR: case BT_LF: + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + case BT_GT: + case BT_RPAR: + case BT_COMMA: + case BT_VERBAR: + case BT_LSQB: + case BT_PERCNT: + case BT_S: + case BT_CR: + case BT_LF: *nextTokPtr = ptr; return tok; -#ifdef XML_NS +# ifdef XML_NS case BT_COLON: ptr += MINBPC(enc); switch (tok) { @@ -1150,7 +1216,7 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, REQUIRE_CHAR(enc, ptr, end); tok = XML_TOK_PREFIXED_NAME; switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) + CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) default: tok = XML_TOK_NMTOKEN; break; @@ -1161,23 +1227,23 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, break; } break; -#endif +# endif case BT_PLUS: - if (tok == XML_TOK_NMTOKEN) { + if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_NAME_PLUS; case BT_AST: - if (tok == XML_TOK_NMTOKEN) { + if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } *nextTokPtr = ptr + MINBPC(enc); return XML_TOK_NAME_ASTERISK; case BT_QUEST: - if (tok == XML_TOK_NMTOKEN) { + if (tok == XML_TOK_NMTOKEN) { *nextTokPtr = ptr; return XML_TOK_INVALID; } @@ -1192,21 +1258,30 @@ PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, } static int PTRCALL -PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ +PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) { const char *start; if (ptr >= end) return XML_TOK_NONE; - else if (! HAS_CHAR(enc, ptr, end)) - return XML_TOK_PARTIAL; + else if (! HAS_CHAR(enc, ptr, end)) { + /* This line cannot be executed. The incoming data has already + * been tokenized once, so incomplete characters like this have + * already been eliminated from the input. Retaining the paranoia + * check is still valuable, however. + */ + return XML_TOK_PARTIAL; /* LCOV_EXCL_LINE */ + } start = ptr; while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE +# define LEAD_CASE(n) \ + case BT_LEAD##n: \ + ptr += n; /* NOTE: The encoding has already been validated. */ \ + break; + LEAD_CASE(2) + LEAD_CASE(3) + LEAD_CASE(4) +# undef LEAD_CASE case BT_AMP: if (ptr == start) return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); @@ -1252,21 +1327,30 @@ PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, } static int PTRCALL -PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ +PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) { const char *start; if (ptr >= end) return XML_TOK_NONE; - else if (! HAS_CHAR(enc, ptr, end)) - return XML_TOK_PARTIAL; + else if (! HAS_CHAR(enc, ptr, end)) { + /* This line cannot be executed. The incoming data has already + * been tokenized once, so incomplete characters like this have + * already been eliminated from the input. Retaining the paranoia + * check is still valuable, however. + */ + return XML_TOK_PARTIAL; /* LCOV_EXCL_LINE */ + } start = ptr; while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE +# define LEAD_CASE(n) \ + case BT_LEAD##n: \ + ptr += n; /* NOTE: The encoding has already been validated. */ \ + break; + LEAD_CASE(2) + LEAD_CASE(3) + LEAD_CASE(4) +# undef LEAD_CASE case BT_AMP: if (ptr == start) return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); @@ -1274,8 +1358,7 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, return XML_TOK_DATA_CHARS; case BT_PERCNT: if (ptr == start) { - int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), - end, nextTokPtr); + int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok; } *nextTokPtr = ptr; @@ -1308,12 +1391,11 @@ PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, return XML_TOK_DATA_CHARS; } -#ifdef XML_DTD +# ifdef XML_DTD static int PTRCALL -PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ +PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end, + const char **nextTokPtr) { int level = 0; if (MINBPC(enc) > 1) { size_t n = end - ptr; @@ -1324,7 +1406,7 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, } while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { - INVALID_CASES(ptr, nextTokPtr) + INVALID_CASES(ptr, nextTokPtr) case BT_LT: ptr += MINBPC(enc); REQUIRE_CHAR(enc, ptr, end); @@ -1361,12 +1443,11 @@ PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, return XML_TOK_PARTIAL; } -#endif /* XML_DTD */ +# endif /* XML_DTD */ static int PTRCALL PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, - const char **badPtr) -{ + const char **badPtr) { ptr += MINBPC(enc); end -= MINBPC(enc); for (; HAS_CHAR(enc, ptr, end); ptr += MINBPC(enc)) { @@ -1389,9 +1470,9 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, case BT_AST: case BT_PERCNT: case BT_NUM: -#ifdef XML_NS +# ifdef XML_NS case BT_COLON: -#endif +# endif break; case BT_S: if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) { @@ -1401,8 +1482,9 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, break; case BT_NAME: case BT_NMSTRT: - if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) + if (! (BYTE_TO_ASCII(enc, ptr) & ~0x7f)) break; + /* fall through */ default: switch (BYTE_TO_ASCII(enc, ptr)) { case 0x24: /* $ */ @@ -1424,9 +1506,8 @@ PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, */ static int PTRCALL -PREFIX(getAtts)(const ENCODING *enc, const char *ptr, - int attsMax, ATTRIBUTE *atts) -{ +PREFIX(getAtts)(const ENCODING *enc, const char *ptr, int attsMax, + ATTRIBUTE *atts) { enum { other, inName, inValue } state = inName; int nAtts = 0; int open = 0; /* defined when state == inValue; @@ -1434,32 +1515,35 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr, for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { switch (BYTE_TYPE(enc, ptr)) { -#define START_NAME \ - if (state == other) { \ - if (nAtts < attsMax) { \ - atts[nAtts].name = ptr; \ - atts[nAtts].normalized = 1; \ - } \ - state = inName; \ - } -#define LEAD_CASE(n) \ - case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE +# define START_NAME \ + if (state == other) { \ + if (nAtts < attsMax) { \ + atts[nAtts].name = ptr; \ + atts[nAtts].normalized = 1; \ + } \ + state = inName; \ + } +# define LEAD_CASE(n) \ + case BT_LEAD##n: /* NOTE: The encoding has already been validated. */ \ + START_NAME ptr += (n - MINBPC(enc)); \ + break; + LEAD_CASE(2) + LEAD_CASE(3) + LEAD_CASE(4) +# undef LEAD_CASE case BT_NONASCII: case BT_NMSTRT: case BT_HEX: START_NAME break; -#undef START_NAME +# undef START_NAME case BT_QUOT: if (state != inValue) { if (nAtts < attsMax) atts[nAtts].valuePtr = ptr + MINBPC(enc); state = inValue; open = BT_QUOT; - } - else if (open == BT_QUOT) { + } else if (open == BT_QUOT) { state = other; if (nAtts < attsMax) atts[nAtts].valueEnd = ptr; @@ -1472,8 +1556,7 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr, atts[nAtts].valuePtr = ptr + MINBPC(enc); state = inValue; open = BT_APOS; - } - else if (open == BT_APOS) { + } else if (open == BT_APOS) { state = other; if (nAtts < attsMax) atts[nAtts].valueEnd = ptr; @@ -1487,16 +1570,15 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr, case BT_S: if (state == inName) state = other; - else if (state == inValue - && nAtts < attsMax - && atts[nAtts].normalized + else if (state == inValue && nAtts < attsMax && atts[nAtts].normalized && (ptr == atts[nAtts].valuePtr || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) atts[nAtts].normalized = 0; break; - case BT_CR: case BT_LF: + case BT_CR: + case BT_LF: /* This case ensures that the first attribute name is counted Apart from that we could just change state on the quote. */ if (state == inName) @@ -1517,29 +1599,44 @@ PREFIX(getAtts)(const ENCODING *enc, const char *ptr, } static int PTRFASTCALL -PREFIX(charRefNumber)(const ENCODING *UNUSED_P(enc), const char *ptr) -{ +PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) { int result = 0; /* skip &# */ - ptr += 2*MINBPC(enc); + UNUSED_P(enc); + ptr += 2 * MINBPC(enc); if (CHAR_MATCHES(enc, ptr, ASCII_x)) { - for (ptr += MINBPC(enc); - !CHAR_MATCHES(enc, ptr, ASCII_SEMI); + for (ptr += MINBPC(enc); ! CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { int c = BYTE_TO_ASCII(enc, ptr); switch (c) { - case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4: - case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9: + case ASCII_0: + case ASCII_1: + case ASCII_2: + case ASCII_3: + case ASCII_4: + case ASCII_5: + case ASCII_6: + case ASCII_7: + case ASCII_8: + case ASCII_9: result <<= 4; result |= (c - ASCII_0); break; - case ASCII_A: case ASCII_B: case ASCII_C: - case ASCII_D: case ASCII_E: case ASCII_F: + case ASCII_A: + case ASCII_B: + case ASCII_C: + case ASCII_D: + case ASCII_E: + case ASCII_F: result <<= 4; result += 10 + (c - ASCII_A); break; - case ASCII_a: case ASCII_b: case ASCII_c: - case ASCII_d: case ASCII_e: case ASCII_f: + case ASCII_a: + case ASCII_b: + case ASCII_c: + case ASCII_d: + case ASCII_e: + case ASCII_f: result <<= 4; result += 10 + (c - ASCII_a); break; @@ -1547,9 +1644,8 @@ PREFIX(charRefNumber)(const ENCODING *UNUSED_P(enc), const char *ptr) if (result >= 0x110000) return -1; } - } - else { - for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { + } else { + for (; ! CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { int c = BYTE_TO_ASCII(enc, ptr); result *= 10; result += (c - ASCII_0); @@ -1561,10 +1657,10 @@ PREFIX(charRefNumber)(const ENCODING *UNUSED_P(enc), const char *ptr) } static int PTRCALL -PREFIX(predefinedEntityName)(const ENCODING *UNUSED_P(enc), const char *ptr, - const char *end) -{ - switch ((end - ptr)/MINBPC(enc)) { +PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, + const char *end) { + UNUSED_P(enc); + switch ((end - ptr) / MINBPC(enc)) { case 2: if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) { switch (BYTE_TO_ASCII(enc, ptr)) { @@ -1615,97 +1711,42 @@ PREFIX(predefinedEntityName)(const ENCODING *UNUSED_P(enc), const char *ptr, } static int PTRCALL -PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr1)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (*ptr1++ != *ptr2++) \ - return 0; - LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) -#undef LEAD_CASE - /* fall through */ - if (*ptr1++ != *ptr2++) - return 0; - break; - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 1) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 2) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 3) { - if (*ptr2++ != *ptr1++) - return 0; - } - } - } - break; - default: - if (MINBPC(enc) == 1 && *ptr1 == *ptr2) - return 1; - switch (BYTE_TYPE(enc, ptr2)) { - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - return 0; - default: - return 1; - } - } - } - /* not reached */ -} - -static int PTRCALL -PREFIX(nameMatchesAscii)(const ENCODING *UNUSED_P(enc), const char *ptr1, - const char *end1, const char *ptr2) -{ +PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, + const char *end1, const char *ptr2) { + UNUSED_P(enc); for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { - if (end1 - ptr1 < MINBPC(enc)) - return 0; - if (!CHAR_MATCHES(enc, ptr1, *ptr2)) + if (end1 - ptr1 < MINBPC(enc)) { + /* This line cannot be executed. The incoming data has already + * been tokenized once, so incomplete characters like this have + * already been eliminated from the input. Retaining the + * paranoia check is still valuable, however. + */ + return 0; /* LCOV_EXCL_LINE */ + } + if (! CHAR_MATCHES(enc, ptr1, *ptr2)) return 0; } return ptr1 == end1; } static int PTRFASTCALL -PREFIX(nameLength)(const ENCODING *enc, const char *ptr) -{ +PREFIX(nameLength)(const ENCODING *enc, const char *ptr) { const char *start = ptr; for (;;) { switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE +# define LEAD_CASE(n) \ + case BT_LEAD##n: \ + ptr += n; /* NOTE: The encoding has already been validated. */ \ + break; + LEAD_CASE(2) + LEAD_CASE(3) + LEAD_CASE(4) +# undef LEAD_CASE case BT_NONASCII: case BT_NMSTRT: -#ifdef XML_NS +# ifdef XML_NS case BT_COLON: -#endif +# endif case BT_HEX: case BT_DIGIT: case BT_NAME: @@ -1718,9 +1759,8 @@ PREFIX(nameLength)(const ENCODING *enc, const char *ptr) } } -static const char * PTRFASTCALL -PREFIX(skipS)(const ENCODING *enc, const char *ptr) -{ +static const char *PTRFASTCALL +PREFIX(skipS)(const ENCODING *enc, const char *ptr) { for (;;) { switch (BYTE_TYPE(enc, ptr)) { case BT_LF: @@ -1735,21 +1775,21 @@ PREFIX(skipS)(const ENCODING *enc, const char *ptr) } static void PTRCALL -PREFIX(updatePosition)(const ENCODING *enc, - const char *ptr, - const char *end, - POSITION *pos) -{ +PREFIX(updatePosition)(const ENCODING *enc, const char *ptr, const char *end, + POSITION *pos) { while (HAS_CHAR(enc, ptr, end)) { switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE +# define LEAD_CASE(n) \ + case BT_LEAD##n: \ + ptr += n; /* NOTE: The encoding has already been validated. */ \ + pos->columnNumber++; \ + break; + LEAD_CASE(2) + LEAD_CASE(3) + LEAD_CASE(4) +# undef LEAD_CASE case BT_LF: - pos->columnNumber = (XML_Size)-1; + pos->columnNumber = 0; pos->lineNumber++; ptr += MINBPC(enc); break; @@ -1758,22 +1798,22 @@ PREFIX(updatePosition)(const ENCODING *enc, ptr += MINBPC(enc); if (HAS_CHAR(enc, ptr, end) && BYTE_TYPE(enc, ptr) == BT_LF) ptr += MINBPC(enc); - pos->columnNumber = (XML_Size)-1; + pos->columnNumber = 0; break; default: ptr += MINBPC(enc); + pos->columnNumber++; break; } - pos->columnNumber++; } } -#undef DO_LEAD_CASE -#undef MULTIBYTE_CASES -#undef INVALID_CASES -#undef CHECK_NAME_CASE -#undef CHECK_NAME_CASES -#undef CHECK_NMSTRT_CASE -#undef CHECK_NMSTRT_CASES +# undef DO_LEAD_CASE +# undef MULTIBYTE_CASES +# undef INVALID_CASES +# undef CHECK_NAME_CASE +# undef CHECK_NAME_CASES +# undef CHECK_NMSTRT_CASE +# undef CHECK_NMSTRT_CASES #endif /* XML_TOK_IMPL_C */ diff --git a/deps/EXPAT/expat/xmltok_ns.inc b/deps/EXPAT/expat/xmltok_ns.inc index c3b88fdf4..fbdd3e3c7 100644 --- a/deps/EXPAT/expat/xmltok_ns.inc +++ b/deps/EXPAT/expat/xmltok_ns.inc @@ -1,61 +1,83 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. +/* This file is included! + __ __ _ + ___\ \/ /_ __ __ _| |_ + / _ \\ /| '_ \ / _` | __| + | __// \| |_) | (_| | |_ + \___/_/\_\ .__/ \__,_|\__| + |_| XML parser + + Copyright (c) 1997-2000 Thai Open Source Software Center Ltd + Copyright (c) 2000 Clark Cooper + Copyright (c) 2002 Greg Stein + Copyright (c) 2002 Fred L. Drake, Jr. + Copyright (c) 2002-2006 Karl Waclawek + Copyright (c) 2017-2021 Sebastian Pipping + Licensed under the MIT license: + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* This file is included! */ #ifdef XML_TOK_NS_C const ENCODING * -NS(XmlGetUtf8InternalEncoding)(void) -{ +NS(XmlGetUtf8InternalEncoding)(void) { return &ns(internal_utf8_encoding).enc; } const ENCODING * -NS(XmlGetUtf16InternalEncoding)(void) -{ -#if BYTEORDER == 1234 +NS(XmlGetUtf16InternalEncoding)(void) { +# if BYTEORDER == 1234 return &ns(internal_little2_encoding).enc; -#elif BYTEORDER == 4321 +# elif BYTEORDER == 4321 return &ns(internal_big2_encoding).enc; -#else +# else const short n = 1; - return (*(const char *)&n - ? &ns(internal_little2_encoding).enc - : &ns(internal_big2_encoding).enc); -#endif + return (*(const char *)&n ? &ns(internal_little2_encoding).enc + : &ns(internal_big2_encoding).enc); +# endif } -static const ENCODING * const NS(encodings)[] = { - &ns(latin1_encoding).enc, - &ns(ascii_encoding).enc, - &ns(utf8_encoding).enc, - &ns(big2_encoding).enc, - &ns(big2_encoding).enc, - &ns(little2_encoding).enc, - &ns(utf8_encoding).enc /* NO_ENC */ +static const ENCODING *const NS(encodings)[] = { + &ns(latin1_encoding).enc, &ns(ascii_encoding).enc, + &ns(utf8_encoding).enc, &ns(big2_encoding).enc, + &ns(big2_encoding).enc, &ns(little2_encoding).enc, + &ns(utf8_encoding).enc /* NO_ENC */ }; static int PTRCALL NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_PROLOG_STATE, ptr, end, nextTokPtr); + const char **nextTokPtr) { + return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, + ptr, end, nextTokPtr); } static int PTRCALL NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_CONTENT_STATE, ptr, end, nextTokPtr); + const char **nextTokPtr) { + return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, + ptr, end, nextTokPtr); } int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, - const char *name) -{ + const char *name) { int i = getEncodingIndex(name); if (i == UNKNOWN_ENC) return 0; @@ -69,10 +91,9 @@ NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, } static const ENCODING * -NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) -{ -#define ENCODING_MAX 128 - char buf[ENCODING_MAX]; +NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) { +# define ENCODING_MAX 128 + char buf[ENCODING_MAX] = ""; char *p = buf; int i; XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); @@ -88,28 +109,14 @@ NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) } int -NS(XmlParseXmlDecl)(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - return doParseXmlDecl(NS(findEncoding), - isGeneralTextEntity, - enc, - ptr, - end, - badPtr, - versionPtr, - versionEndPtr, - encodingName, - encoding, - standalone); +NS(XmlParseXmlDecl)(int isGeneralTextEntity, const ENCODING *enc, + const char *ptr, const char *end, const char **badPtr, + const char **versionPtr, const char **versionEndPtr, + const char **encodingName, const ENCODING **encoding, + int *standalone) { + return doParseXmlDecl(NS(findEncoding), isGeneralTextEntity, enc, ptr, end, + badPtr, versionPtr, versionEndPtr, encodingName, + encoding, standalone); } #endif /* XML_TOK_NS_C */ diff --git a/deps/OpenSSL/OpenSSL.cmake b/deps/OpenSSL/OpenSSL.cmake index 5715c4a00..b42b1a808 100644 --- a/deps/OpenSSL/OpenSSL.cmake +++ b/deps/OpenSSL/OpenSSL.cmake @@ -40,8 +40,10 @@ endif() ExternalProject_Add(dep_OpenSSL #EXCLUDE_FROM_ALL ON - URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1k.tar.gz" - URL_HASH SHA256=b92f9d3d12043c02860e5e602e50a73ed21a69947bcc74d391f41148e9f6aa95 + #URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1k.tar.gz" + URL "https://github.com/openssl/openssl/archive/refs/tags/openssl-3.1.2.tar.gz" + #URL_HASH SHA256=b92f9d3d12043c02860e5e602e50a73ed21a69947bcc74d391f41148e9f6aa95 + URL_HASH SHA256=8c776993154652d0bb393f506d850b811517c8bd8d24b1008aef57fbe55d3f31 DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenSSL CONFIGURE_COMMAND ${_conf_cmd} ${_cross_arch} "--openssldir=${DESTDIR}/usr/local" @@ -61,4 +63,4 @@ ExternalProject_Add_Step(dep_OpenSSL install_cmake_files COMMAND ${CMAKE_COMMAND} -E copy_directory openssl "${DESTDIR}/usr/local/${CMAKE_INSTALL_LIBDIR}/cmake/openssl" WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" -) \ No newline at end of file +) diff --git a/deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch b/deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch index f176ce287..b7a2f9371 100644 --- a/deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch +++ b/deps/ZLIB/0001-Respect-BUILD_SHARED_LIBS.patch @@ -1,16 +1,16 @@ -Common subdirectories: ../zlib-1.2.11/amiga and ./amiga -diff -u ../zlib-1.2.11/CMakeLists.txt ./CMakeLists.txt ---- ../zlib-1.2.11/CMakeLists.txt 2017-01-15 09:29:40.000000000 +0100 -+++ ./CMakeLists.txt 2021-03-24 15:24:48.190291072 +0100 -@@ -183,10 +183,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b412dc7..5ca7fa8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -147,10 +147,12 @@ if(MINGW) set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) endif(MINGW) --add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) --add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) -set_target_properties(zlib PROPERTIES SOVERSION 1) -+add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++add_library(zlib ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +if (BUILD_SHARED_LIBS) + target_sources(zlib PRIVATE ${ZLIB_DLL_SRCS}) + set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) @@ -19,7 +19,7 @@ diff -u ../zlib-1.2.11/CMakeLists.txt ./CMakeLists.txt if(NOT CYGWIN) # This property causes shared libraries on Linux to have the full version -@@ -201,7 +203,7 @@ +@@ -165,7 +167,7 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz @@ -28,7 +28,7 @@ diff -u ../zlib-1.2.11/CMakeLists.txt ./CMakeLists.txt if(NOT APPLE) set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") endif() -@@ -211,7 +213,7 @@ +@@ -175,7 +177,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32) endif() if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) @@ -37,15 +37,3 @@ diff -u ../zlib-1.2.11/CMakeLists.txt ./CMakeLists.txt RUNTIME DESTINATION "${INSTALL_BIN_DIR}" ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) -Common subdirectories: ../zlib-1.2.11/contrib and ./contrib -Common subdirectories: ../zlib-1.2.11/doc and ./doc -Common subdirectories: ../zlib-1.2.11/examples and ./examples -Common subdirectories: ../zlib-1.2.11/msdos and ./msdos -Common subdirectories: ../zlib-1.2.11/nintendods and ./nintendods -Common subdirectories: ../zlib-1.2.11/old and ./old -Common subdirectories: ../zlib-1.2.11/os400 and ./os400 -Common subdirectories: ../zlib-1.2.11/qnx and ./qnx -Common subdirectories: ../zlib-1.2.11/test and ./test -Common subdirectories: ../zlib-1.2.11/watcom and ./watcom -Common subdirectories: ../zlib-1.2.11/win32 and ./win32 -Only in ./: ZLIB.patch diff --git a/deps/ZLIB/ZLIB.cmake b/deps/ZLIB/ZLIB.cmake index 63002f946..0d5497e41 100644 --- a/deps/ZLIB/ZLIB.cmake +++ b/deps/ZLIB/ZLIB.cmake @@ -1,9 +1,13 @@ +set(patch_command git init && ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-Respect-BUILD_SHARED_LIBS.patch) + orcaslicer_add_cmake_project(ZLIB # GIT_REPOSITORY https://github.com/madler/zlib.git # GIT_TAG v1.2.11 - URL https://github.com/madler/zlib/archive/refs/tags/v1.2.11.zip - URL_HASH SHA256=f5cc4ab910db99b2bdbba39ebbdc225ffc2aa04b4057bc2817f1b94b6978cfc3 - PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-Respect-BUILD_SHARED_LIBS.patch + #URL https://github.com/madler/zlib/archive/refs/tags/v1.2.11.zip + URL https://github.com/madler/zlib/archive/refs/tags/v1.2.13.zip + #URL_HASH SHA256=f5cc4ab910db99b2bdbba39ebbdc225ffc2aa04b4057bc2817f1b94b6978cfc3 + URL_HASH SHA256=c2856951bbf30e30861ace3765595d86ba13f2cf01279d901f6c62258c57f4ff + PATCH_COMMAND ${patch_command} CMAKE_ARGS -DSKIP_INSTALL_FILES=ON # Prevent installation of man pages et al. -DCMAKE_POSITION_INDEPENDENT_CODE=ON diff --git a/localization/i18n/list.txt b/localization/i18n/list.txt index fef73aa60..93ac1c1b5 100644 --- a/localization/i18n/list.txt +++ b/localization/i18n/list.txt @@ -144,4 +144,5 @@ src/slic3r/GUI/BonjourDialog.cpp src/slic3r/GUI/Gizmos/GLGizmoMeshBoolean.cpp src/slic3r/GUI/PrintHostDialogs.cpp src/slic3r/GUI/calib_dlg.cpp -src/slic3r/GUI/PhysicalPrinterDialog.cpp \ No newline at end of file +src/slic3r/GUI/PhysicalPrinterDialog.cpp +src/slic3r/Utils/CalibUtils.cpp \ No newline at end of file diff --git a/resources/config.json b/resources/config.json index 1e9a2acd4..ebd714576 100644 --- a/resources/config.json +++ b/resources/config.json @@ -14,15 +14,17 @@ "FUNC_VIRTUAL_CAMERA": false, "FUNC_PRINT_WITHOUT_SD": false, "FUNC_ALTER_RESOLUTION": false, - "FUNC_PRINT_ALL": false, - "FUNC_EXTRUSION_CALI": true + "FUNC_EXTRUSION_CALI": true, + "FUNC_MOTOR_NOISE_CALI": false, + "FUNC_PROMPT_SOUND": false, + "FUNC_VIRTUAL_TYAY": true }, "camera_resolution": [ "720p" ], "bed_temperature_limit": 100, "model_id": "C11", "printer_type": "C11", - "compatible_machine": [ "BL-P001", "BL-P002", "C12"], + "compatible_machine": [ "BL-P001", "BL-P002", "C12", "C13"], "ftp_folder": "sdcard/", "printer_thumbnail_image": "printer_thumbnail_p1p" }, @@ -41,40 +43,86 @@ "FUNC_PRINT_WITHOUT_SD": false, "FUNC_ALTER_RESOLUTION": false, "FUNC_PRINT_ALL": false, - "FUNC_VIRTUAL_TYAY": true, - "FUNC_EXTRUSION_CALI": true + "FUNC_MOTOR_NOISE_CALI": false, + "FUNC_PROMPT_SOUND": false, + "FUNC_VIRTUAL_TYAY": true }, "camera_resolution": [ "720p" ], "bed_temperature_limit": 100, "model_id": "C12", - "compatible_machine":["BL-P001", "BL-P002", "C11"], + "compatible_machine":["BL-P001", "BL-P002", "C11", "C13"], "printer_type": "C12", "ftp_folder" : "sdcard/", "printer_thumbnail_image": "printer_thumbnail_p1p" }, { - + "display_name": "Bambu Lab A1 mini", + "func": { + "FUNC_CHAMBER_TEMP": false, + "FUNC_FIRSTLAYER_INSPECT": false, + "FUNC_AI_MONITORING": false, + "FUNC_BUILDPLATE_MARKER_DETECT": false, + "FUNC_FLOW_CALIBRATION": true, + "FUNC_MONITORING": false, + "FUNC_MEDIA_FILE": false, + "FUNC_VIRTUAL_CAMERA": false, + "FUNC_PRINT_WITHOUT_SD": false, + "FUNC_ALTER_RESOLUTION": true, + "FUNC_CHAMBER_FAN": false, + "FUNC_AUX_FAN": false, + "FUNC_UPDATE_REMAIN": false, + "FUNC_EXTRUSION_CALI": false, + "FUNC_AUTO_LEVELING": true + }, + "printer_arch" : "i3", + "camera_resolution": [ "720p" ], + "bed_temperature_limit": 100, + "model_id": "N1", + "compatible_machine":[], + "printer_type": "N1", + "ftp_folder" : "sdcard/", + "printer_thumbnail_image": "printer_thumbnail_n1" + }, + { "display_name": "Bambu Lab X1", "func": { + "FUNC_CHAMBER_TEMP": false, "FUNC_VIRTUAL_TYAY": true, "FUNC_EXTRUSION_CALI": false, - "FUNC_LOCAL_TUNNEL": false + "FUNC_MOTOR_NOISE_CALI": false, + "FUNC_PROMPT_SOUND": false }, "model_id": "BL-P002", - "compatible_machine": [ "BL-P001", "C11", "C12"], + "compatible_machine": [ "BL-P001", "C11", "C12", "C13"], "camera_resolution": [ "720p", "1080p" ], "printer_type": "3DPrinter-X1", "printer_thumbnail_image": "printer_thumbnail" }, + { + "display_name": "Bambu Lab X1E", + "func": { + "FUNC_MOTOR_NOISE_CALI": false, + "FUNC_PROMPT_SOUND": false + }, + "camera_resolution": [ "720p", "1080p" ], + "nozzle_max_temperature": 330, + "model_id": "C13", + "compatible_machine": [ "BL-P001", "BL-P002", "C11", "C12"], + "printer_type": "C13", + "printer_thumbnail_image": "printer_thumbnail" + }, { "display_name": "Bambu Lab X1 Carbon", "func": { + "FUNC_CHAMBER_TEMP": false, "FUNC_VIRTUAL_TYAY": true, "FUNC_EXTRUSION_CALI": false, - "FUNC_LOCAL_TUNNEL": false + "FUNC_LOCAL_TUNNEL": false, + "FUNC_MOTOR_NOISE_CALI": false, + "FUNC_PROMPT_SOUND": false }, "model_id": "BL-P001", - "compatible_machine": [ "BL-P002", "C11", "C12"], + "compatible_machine": [ "BL-P002", "C11", "C12", "C13"], "camera_resolution": [ "720p", "1080p" ], "printer_type": "3DPrinter-X1-Carbon", "printer_thumbnail_image": "printer_thumbnail" diff --git a/resources/handy_models/Disc.stl b/resources/handy_models/Disc.stl new file mode 100644 index 000000000..f19bf81ff Binary files /dev/null and b/resources/handy_models/Disc.stl differ diff --git a/resources/images/ams_extra_framework_mid.svg b/resources/images/ams_extra_framework_mid.svg new file mode 100644 index 000000000..480ae748b --- /dev/null +++ b/resources/images/ams_extra_framework_mid.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/bbl_bed_ep_bottom.svg b/resources/images/bbl_bed_ep_bottom.svg index 8c3373139..2ef998bba 100644 --- a/resources/images/bbl_bed_ep_bottom.svg +++ b/resources/images/bbl_bed_ep_bottom.svg @@ -1,71 +1,71 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/bbl_bed_ep_left.svg b/resources/images/bbl_bed_ep_left.svg index 06d0b1091..5ae83ea4a 100644 --- a/resources/images/bbl_bed_ep_left.svg +++ b/resources/images/bbl_bed_ep_left.svg @@ -1,26 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/bbl_bed_pc_bottom.svg b/resources/images/bbl_bed_pc_bottom.svg index cccc20063..357994a0f 100644 --- a/resources/images/bbl_bed_pc_bottom.svg +++ b/resources/images/bbl_bed_pc_bottom.svg @@ -1,67 +1,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/bbl_bed_pc_left.svg b/resources/images/bbl_bed_pc_left.svg index d8acdd5b1..5d3d78775 100644 --- a/resources/images/bbl_bed_pc_left.svg +++ b/resources/images/bbl_bed_pc_left.svg @@ -1,18 +1,16 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/resources/images/bbl_bed_pei_bottom.svg b/resources/images/bbl_bed_pei_bottom.svg index 8143d03a2..57303a7f5 100644 --- a/resources/images/bbl_bed_pei_bottom.svg +++ b/resources/images/bbl_bed_pei_bottom.svg @@ -1,68 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/bbl_bed_pei_left.svg b/resources/images/bbl_bed_pei_left.svg index 11ca8892b..91fe15040 100644 --- a/resources/images/bbl_bed_pei_left.svg +++ b/resources/images/bbl_bed_pei_left.svg @@ -1,28 +1,35 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/bbl_bed_pte_bottom.svg b/resources/images/bbl_bed_pte_bottom.svg index cf00a644d..529471e53 100644 --- a/resources/images/bbl_bed_pte_bottom.svg +++ b/resources/images/bbl_bed_pte_bottom.svg @@ -1,33 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/bbl_bed_pte_left.svg b/resources/images/bbl_bed_pte_left.svg index ce812d76b..c2ddff20d 100644 --- a/resources/images/bbl_bed_pte_left.svg +++ b/resources/images/bbl_bed_pte_left.svg @@ -1,34 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/enable_ams_disable.svg b/resources/images/enable_ams_disable.svg new file mode 100644 index 000000000..69060f2a1 --- /dev/null +++ b/resources/images/enable_ams_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/extra_ams_tray_left.svg b/resources/images/extra_ams_tray_left.svg new file mode 100644 index 000000000..f2aae5c5e --- /dev/null +++ b/resources/images/extra_ams_tray_left.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/resources/images/extra_ams_tray_left_hover.svg b/resources/images/extra_ams_tray_left_hover.svg new file mode 100644 index 000000000..aff51a25d --- /dev/null +++ b/resources/images/extra_ams_tray_left_hover.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/resources/images/extra_ams_tray_left_selected.svg b/resources/images/extra_ams_tray_left_selected.svg new file mode 100644 index 000000000..b63329c06 --- /dev/null +++ b/resources/images/extra_ams_tray_left_selected.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/resources/images/extra_ams_tray_right.svg b/resources/images/extra_ams_tray_right.svg new file mode 100644 index 000000000..993222a8d --- /dev/null +++ b/resources/images/extra_ams_tray_right.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/resources/images/extra_ams_tray_right_hover.svg b/resources/images/extra_ams_tray_right_hover.svg new file mode 100644 index 000000000..01a634981 --- /dev/null +++ b/resources/images/extra_ams_tray_right_hover.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/resources/images/extra_ams_tray_right_selected.svg b/resources/images/extra_ams_tray_right_selected.svg new file mode 100644 index 000000000..3fbb312a7 --- /dev/null +++ b/resources/images/extra_ams_tray_right_selected.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/resources/images/fd_pattern_manual.png b/resources/images/fd_pattern_manual.png new file mode 100644 index 000000000..2aefb4edb Binary files /dev/null and b/resources/images/fd_pattern_manual.png differ diff --git a/resources/images/fd_pattern_manual_result.png b/resources/images/fd_pattern_manual_result.png new file mode 100644 index 000000000..dfea0e00b Binary files /dev/null and b/resources/images/fd_pattern_manual_result.png differ diff --git a/resources/images/fd_pattern_manual_result_CN.png b/resources/images/fd_pattern_manual_result_CN.png new file mode 100644 index 000000000..255aed5f0 Binary files /dev/null and b/resources/images/fd_pattern_manual_result_CN.png differ diff --git a/resources/images/input_access_code_n1_cn.png b/resources/images/input_access_code_n1_cn.png new file mode 100644 index 000000000..773dc0314 Binary files /dev/null and b/resources/images/input_access_code_n1_cn.png differ diff --git a/resources/images/input_access_code_n1_en.png b/resources/images/input_access_code_n1_en.png new file mode 100644 index 000000000..0ebdf87fc Binary files /dev/null and b/resources/images/input_access_code_n1_en.png differ diff --git a/resources/images/monitor_network_wired.svg b/resources/images/monitor_network_wired.svg new file mode 100644 index 000000000..8a6a0716b --- /dev/null +++ b/resources/images/monitor_network_wired.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/resources/images/monitor_upgrade_f1.svg b/resources/images/monitor_upgrade_f1.svg new file mode 100644 index 000000000..eec95433f --- /dev/null +++ b/resources/images/monitor_upgrade_f1.svg @@ -0,0 +1,502 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/open_in_browser.svg b/resources/images/open_in_browser.svg new file mode 100644 index 000000000..c445ea26e --- /dev/null +++ b/resources/images/open_in_browser.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/resources/images/oss_picture_load_failed.png b/resources/images/oss_picture_load_failed.png new file mode 100644 index 000000000..d436988a7 Binary files /dev/null and b/resources/images/oss_picture_load_failed.png differ diff --git a/resources/images/oss_picture_loading.png b/resources/images/oss_picture_loading.png new file mode 100644 index 000000000..9dd4029b3 Binary files /dev/null and b/resources/images/oss_picture_loading.png differ diff --git a/resources/images/printer_thumbnail_n1.svg b/resources/images/printer_thumbnail_n1.svg new file mode 100644 index 000000000..87022438d --- /dev/null +++ b/resources/images/printer_thumbnail_n1.svg @@ -0,0 +1,1295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/printer_thumbnail_n1_dark.svg b/resources/images/printer_thumbnail_n1_dark.svg new file mode 100644 index 000000000..87022438d --- /dev/null +++ b/resources/images/printer_thumbnail_n1_dark.svg @@ -0,0 +1,1295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/images/score_star_dark.svg b/resources/images/score_star_dark.svg new file mode 100644 index 000000000..d703eafb7 --- /dev/null +++ b/resources/images/score_star_dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/score_star_light.svg b/resources/images/score_star_light.svg new file mode 100644 index 000000000..909390e07 --- /dev/null +++ b/resources/images/score_star_light.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/single_little_photo.svg b/resources/images/single_little_photo.svg new file mode 100644 index 000000000..3b1bedb46 --- /dev/null +++ b/resources/images/single_little_photo.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/resources/images/single_little_photo_dark.svg b/resources/images/single_little_photo_dark.svg new file mode 100644 index 000000000..915faa0fa --- /dev/null +++ b/resources/images/single_little_photo_dark.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/resources/profiles/Anker.json b/resources/profiles/Anker.json index 38904a3bc..fce55a765 100644 --- a/resources/profiles/Anker.json +++ b/resources/profiles/Anker.json @@ -147,4 +147,4 @@ "sub_path": "machine/Anker M5C 0.4 nozzle.json" } ] -} +} \ No newline at end of file diff --git a/resources/profiles/Anker/machine/fdm_machine_common.json b/resources/profiles/Anker/machine/fdm_machine_common.json index ab862da58..e388cbb5c 100644 --- a/resources/profiles/Anker/machine/fdm_machine_common.json +++ b/resources/profiles/Anker/machine/fdm_machine_common.json @@ -73,6 +73,9 @@ "0.05" ], "printable_height": "250", + "retract_lift_below":[ + "249" + ], "nozzle_diameter": [ "0.4" ], diff --git a/resources/profiles/Anycubic.json b/resources/profiles/Anycubic.json index 410576d4e..4b8358e3f 100644 --- a/resources/profiles/Anycubic.json +++ b/resources/profiles/Anycubic.json @@ -247,4 +247,4 @@ "sub_path": "machine/Anycubic Kobra 2 0.4 nozzle.json" } ] -} +} \ No newline at end of file diff --git a/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json index 87965146c..ffbaa9d3e 100644 --- a/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 0.4 nozzle.json @@ -20,6 +20,9 @@ "0x205" ], "printable_height": "200", + "retract_lift_below":[ + "199" + ], "machine_start_gcode": "M190 S[bed_temperature_initial_layer_single]\nM109 S[nozzle_temperature_initial_layer]\nPRINT_START EXTRUDER=[nozzle_temperature_initial_layer] BED=[bed_temperature_initial_layer_single]\n; You can use following code instead if your PRINT_START macro support Chamber and print area bedmesh\n; PRINT_START EXTRUDER=[nozzle_temperature_initial_layer] BED=[bed_temperature_initial_layer_single] Chamber=[chamber_temperature] PRINT_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} PRINT_MAX={first_layer_print_max[0]},{first_layer_print_max[1]}", "machine_end_gcode": "PRINT_END", "layer_change_gcode": "", diff --git a/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 2 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 2 0.4 nozzle.json index 583653ce6..884b8ed97 100644 --- a/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 2 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic 4Max Pro 2 0.4 nozzle.json @@ -17,6 +17,9 @@ "0x210" ], "printable_height": "190", + "retract_lift_below":[ + "189" + ], "nozzle_type": "undefine", "auxiliary_fan": "0", "machine_max_acceleration_extruding": [ diff --git a/resources/profiles/Anycubic/machine/Anycubic Chiron 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic Chiron 0.4 nozzle.json index b9b38159e..484af019a 100644 --- a/resources/profiles/Anycubic/machine/Anycubic Chiron 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic Chiron 0.4 nozzle.json @@ -17,6 +17,9 @@ "0x400" ], "printable_height": "450", + "retract_lift_below":[ + "449" + ], "nozzle_type": "undefine", "auxiliary_fan": "0", "machine_max_acceleration_e": [ diff --git a/resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json index 8c8c4c12b..b13d8f1c0 100644 --- a/resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json @@ -17,6 +17,9 @@ "0x400" ], "printable_height": "450", + "retract_lift_below":[ + "449" + ], "nozzle_type": "undefine", "auxiliary_fan": "0", "machine_max_acceleration_e": [ diff --git a/resources/profiles/Anycubic/machine/Anycubic Vyper 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic Vyper 0.4 nozzle.json index 01c8ff1d7..66bbd4f90 100644 --- a/resources/profiles/Anycubic/machine/Anycubic Vyper 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic Vyper 0.4 nozzle.json @@ -17,6 +17,9 @@ "0x255" ], "printable_height": "265", + "retract_lift_below":[ + "264" + ], "nozzle_type": "undefine", "auxiliary_fan": "0", "machine_max_acceleration_extruding": [ diff --git a/resources/profiles/Anycubic/machine/Anycubic i3 Mega S 0.4 nozzle.json b/resources/profiles/Anycubic/machine/Anycubic i3 Mega S 0.4 nozzle.json index 709dcf918..9c69f8205 100644 --- a/resources/profiles/Anycubic/machine/Anycubic i3 Mega S 0.4 nozzle.json +++ b/resources/profiles/Anycubic/machine/Anycubic i3 Mega S 0.4 nozzle.json @@ -17,6 +17,9 @@ "0x210" ], "printable_height": "205", + "retract_lift_below":[ + "204" + ], "nozzle_type": "undefine", "auxiliary_fan": "0", "machine_max_acceleration_e": [ diff --git a/resources/profiles/BBL.json b/resources/profiles/BBL.json index d5e9c5882..387892999 100644 --- a/resources/profiles/BBL.json +++ b/resources/profiles/BBL.json @@ -1,7 +1,7 @@ { "name": "Bambulab", "url": "http://www.bambulab.com/Parameters/vendor/BBL.json", - "version": "01.07.00.18", + "version": "01.07.00.25", "force_update": "0", "description": "the initial version of BBL configurations", "machine_model_list": [ @@ -20,6 +20,10 @@ { "name": "Bambu Lab P1S", "sub_path": "machine/Bambu Lab P1S.json" + }, + { + "name": "Bambu Lab A1 mini", + "sub_path": "machine/Bambu Lab A1 mini.json" } ], "process_list": [ @@ -67,94 +71,6 @@ "name": "fdm_process_bbl_0.28", "sub_path": "process/fdm_process_bbl_0.28.json" }, - { - "name": "0.08mm Extra Fine @BBL X1C", - "sub_path": "process/0.08mm Extra Fine @BBL X1C.json" - }, - { - "name": "0.12mm Fine @BBL X1C", - "sub_path": "process/0.12mm Fine @BBL X1C.json" - }, - { - "name": "0.16mm Optimal @BBL X1C", - "sub_path": "process/0.16mm Optimal @BBL X1C.json" - }, - { - "name": "0.20mm Standard @BBL X1C", - "sub_path": "process/0.20mm Standard @BBL X1C.json" - }, - { - "name": "0.20mm Strength @BBL X1C", - "sub_path": "process/0.20mm Strength @BBL X1C.json" - }, - { - "name": "0.24mm Draft @BBL X1C", - "sub_path": "process/0.24mm Draft @BBL X1C.json" - }, - { - "name": "0.28mm Extra Draft @BBL X1C", - "sub_path": "process/0.28mm Extra Draft @BBL X1C.json" - }, - { - "name": "0.10mm Standard @BBL X1C 0.2 nozzle", - "sub_path": "process/0.10mm Standard @BBL X1C 0.2 nozzle.json" - }, - { - "name": "0.30mm Standard @BBL X1C 0.6 nozzle", - "sub_path": "process/0.30mm Standard @BBL X1C 0.6 nozzle.json" - }, - { - "name": "0.30mm Standard @BBL X1 0.6 nozzle", - "sub_path": "process/0.30mm Standard @BBL X1 0.6 nozzle.json" - }, - { - "name": "0.40mm Standard @BBL X1C 0.8 nozzle", - "sub_path": "process/0.40mm Standard @BBL X1C 0.8 nozzle.json" - }, - { - "name": "0.40mm Standard @BBL X1 0.8 nozzle", - "sub_path": "process/0.40mm Standard @BBL X1 0.8 nozzle.json" - }, - { - "name": "0.10mm Standard @BBL P1P 0.2 nozzle", - "sub_path": "process/0.10mm Standard @BBL P1P 0.2 nozzle.json" - }, - { - "name": "0.20mm Standard @BBL P1P", - "sub_path": "process/0.20mm Standard @BBL P1P.json" - }, - { - "name": "0.30mm Standard @BBL P1P 0.6 nozzle", - "sub_path": "process/0.30mm Standard @BBL P1P 0.6 nozzle.json" - }, - { - "name": "0.08mm Extra Fine @BBL P1P", - "sub_path": "process/0.08mm Extra Fine @BBL P1P.json" - }, - { - "name": "0.12mm Fine @BBL P1P", - "sub_path": "process/0.12mm Fine @BBL P1P.json" - }, - { - "name": "0.16mm Optimal @BBL P1P", - "sub_path": "process/0.16mm Optimal @BBL P1P.json" - }, - { - "name": "0.20mm Strength @BBL P1P", - "sub_path": "process/0.20mm Strength @BBL P1P.json" - }, - { - "name": "0.24mm Draft @BBL P1P", - "sub_path": "process/0.24mm Draft @BBL P1P.json" - }, - { - "name": "0.28mm Extra Draft @BBL P1P", - "sub_path": "process/0.28mm Extra Draft @BBL P1P.json" - }, - { - "name": "0.40mm Standard @BBL P1P 0.8 nozzle", - "sub_path": "process/0.40mm Standard @BBL P1P 0.8 nozzle.json" - }, { "name": "fdm_process_bbl_0.06_nozzle_0.2", "sub_path": "process/fdm_process_bbl_0.06_nozzle_0.2.json" @@ -171,22 +87,6 @@ "name": "fdm_process_bbl_0.14_nozzle_0.2", "sub_path": "process/fdm_process_bbl_0.14_nozzle_0.2.json" }, - { - "name": "0.06mm Standard @BBL X1C 0.2 nozzle", - "sub_path": "process/0.06mm Standard @BBL X1C 0.2 nozzle.json" - }, - { - "name": "0.08mm Standard @BBL X1C 0.2 nozzle", - "sub_path": "process/0.08mm Standard @BBL X1C 0.2 nozzle.json" - }, - { - "name": "0.12mm Standard @BBL X1C 0.2 nozzle", - "sub_path": "process/0.12mm Standard @BBL X1C 0.2 nozzle.json" - }, - { - "name": "0.14mm Standard @BBL X1C 0.2 nozzle", - "sub_path": "process/0.14mm Standard @BBL X1C 0.2 nozzle.json" - }, { "name": "fdm_process_bbl_0.18_nozzle_0.6", "sub_path": "process/fdm_process_bbl_0.18_nozzle_0.6.json" @@ -203,22 +103,6 @@ "name": "fdm_process_bbl_0.42_nozzle_0.6", "sub_path": "process/fdm_process_bbl_0.42_nozzle_0.6.json" }, - { - "name": "0.18mm Standard @BBL X1C 0.6 nozzle", - "sub_path": "process/0.18mm Standard @BBL X1C 0.6 nozzle.json" - }, - { - "name": "0.24mm Standard @BBL X1C 0.6 nozzle", - "sub_path": "process/0.24mm Standard @BBL X1C 0.6 nozzle.json" - }, - { - "name": "0.36mm Standard @BBL X1C 0.6 nozzle", - "sub_path": "process/0.36mm Standard @BBL X1C 0.6 nozzle.json" - }, - { - "name": "0.42mm Standard @BBL X1C 0.6 nozzle", - "sub_path": "process/0.42mm Standard @BBL X1C 0.6 nozzle.json" - }, { "name": "fdm_process_bbl_0.24_nozzle_0.8", "sub_path": "process/fdm_process_bbl_0.24_nozzle_0.8.json" @@ -235,25 +119,237 @@ "name": "fdm_process_bbl_0.56_nozzle_0.8", "sub_path": "process/fdm_process_bbl_0.56_nozzle_0.8.json" }, + { + "name": "0.08mm Extra Fine @BBL X1C", + "sub_path": "process/0.08mm Extra Fine @BBL X1C.json" + }, + { + "name": "0.08mm Extra Fine @BBL P1P", + "sub_path": "process/0.08mm Extra Fine @BBL P1P.json" + }, + { + "name": "0.08mm Extra Fine @BBL A1M", + "sub_path": "process/0.08mm Extra Fine @BBL A1M.json" + }, + { + "name": "0.10mm Standard @BBL X1C 0.2 nozzle", + "sub_path": "process/0.10mm Standard @BBL X1C 0.2 nozzle.json" + }, + { + "name": "0.10mm Standard @BBL P1P 0.2 nozzle", + "sub_path": "process/0.10mm Standard @BBL P1P 0.2 nozzle.json" + }, + { + "name": "0.40mm Standard @BBL X1C 0.8 nozzle", + "sub_path": "process/0.40mm Standard @BBL X1C 0.8 nozzle.json" + }, + { + "name": "0.40mm Standard @BBL X1 0.8 nozzle", + "sub_path": "process/0.40mm Standard @BBL X1 0.8 nozzle.json" + }, + { + "name": "0.40mm Standard @BBL P1P 0.8 nozzle", + "sub_path": "process/0.40mm Standard @BBL P1P 0.8 nozzle.json" + }, + { + "name": "0.30mm Standard @BBL X1C 0.6 nozzle", + "sub_path": "process/0.30mm Standard @BBL X1C 0.6 nozzle.json" + }, + { + "name": "0.30mm Standard @BBL X1 0.6 nozzle", + "sub_path": "process/0.30mm Standard @BBL X1 0.6 nozzle.json" + }, + { + "name": "0.30mm Standard @BBL P1P 0.6 nozzle", + "sub_path": "process/0.30mm Standard @BBL P1P 0.6 nozzle.json" + }, + { + "name": "0.30mm Strength @BBL X1C 0.6 nozzle", + "sub_path": "process/0.30mm Strength @BBL X1C 0.6 nozzle.json" + }, + { + "name": "0.30mm Strength @BBL A1M 0.6 nozzle", + "sub_path": "process/0.30mm Strength @BBL A1M 0.6 nozzle.json" + }, + { + "name": "0.12mm Fine @BBL X1C", + "sub_path": "process/0.12mm Fine @BBL X1C.json" + }, + { + "name": "0.12mm Fine @BBL P1P", + "sub_path": "process/0.12mm Fine @BBL P1P.json" + }, + { + "name": "0.12mm Fine @BBL A1M", + "sub_path": "process/0.12mm Fine @BBL A1M.json" + }, + { + "name": "0.16mm Optimal @BBL X1C", + "sub_path": "process/0.16mm Optimal @BBL X1C.json" + }, + { + "name": "0.16mm Optimal @BBL P1P", + "sub_path": "process/0.16mm Optimal @BBL P1P.json" + }, + { + "name": "0.16mm Optimal @BBL A1M", + "sub_path": "process/0.16mm Optimal @BBL A1M.json" + }, + { + "name": "0.20mm Standard @BBL X1C", + "sub_path": "process/0.20mm Standard @BBL X1C.json" + }, + { + "name": "0.20mm Strength @BBL X1C", + "sub_path": "process/0.20mm Strength @BBL X1C.json" + }, + { + "name": "0.20mm Standard @BBL P1P", + "sub_path": "process/0.20mm Standard @BBL P1P.json" + }, + { + "name": "0.20mm Strength @BBL P1P", + "sub_path": "process/0.20mm Strength @BBL P1P.json" + }, + { + "name": "0.24mm Draft @BBL X1C", + "sub_path": "process/0.24mm Draft @BBL X1C.json" + }, + { + "name": "0.24mm Draft @BBL P1P", + "sub_path": "process/0.24mm Draft @BBL P1P.json" + }, + { + "name": "0.24mm Draft @BBL A1M", + "sub_path": "process/0.24mm Draft @BBL A1M.json" + }, + { + "name": "0.28mm Extra Draft @BBL X1C", + "sub_path": "process/0.28mm Extra Draft @BBL X1C.json" + }, + { + "name": "0.28mm Extra Draft @BBL P1P", + "sub_path": "process/0.28mm Extra Draft @BBL P1P.json" + }, + { + "name": "0.28mm Extra Draft @BBL A1M", + "sub_path": "process/0.28mm Extra Draft @BBL A1M.json" + }, + { + "name": "0.06mm Standard @BBL X1C 0.2 nozzle", + "sub_path": "process/0.06mm Standard @BBL X1C 0.2 nozzle.json" + }, + { + "name": "0.06mm Fine @BBL A1M 0.2 nozzle", + "sub_path": "process/0.06mm Fine @BBL A1M 0.2 nozzle.json" + }, + { + "name": "0.08mm Standard @BBL X1C 0.2 nozzle", + "sub_path": "process/0.08mm Standard @BBL X1C 0.2 nozzle.json" + }, + { + "name": "0.08mm Optimal @BBL A1M 0.2 nozzle", + "sub_path": "process/0.08mm Optimal @BBL A1M 0.2 nozzle.json" + }, + { + "name": "0.12mm Standard @BBL X1C 0.2 nozzle", + "sub_path": "process/0.12mm Standard @BBL X1C 0.2 nozzle.json" + }, + { + "name": "0.12mm Draft @BBL A1M 0.2 nozzle", + "sub_path": "process/0.12mm Draft @BBL A1M 0.2 nozzle.json" + }, + { + "name": "0.14mm Standard @BBL X1C 0.2 nozzle", + "sub_path": "process/0.14mm Standard @BBL X1C 0.2 nozzle.json" + }, + { + "name": "0.14mm Extra Draft @BBL A1M 0.2 nozzle", + "sub_path": "process/0.14mm Extra Draft @BBL A1M 0.2 nozzle.json" + }, + { + "name": "0.18mm Standard @BBL X1C 0.6 nozzle", + "sub_path": "process/0.18mm Standard @BBL X1C 0.6 nozzle.json" + }, + { + "name": "0.18mm Fine @BBL A1M 0.6 nozzle", + "sub_path": "process/0.18mm Fine @BBL A1M 0.6 nozzle.json" + }, + { + "name": "0.24mm Standard @BBL X1C 0.6 nozzle", + "sub_path": "process/0.24mm Standard @BBL X1C 0.6 nozzle.json" + }, + { + "name": "0.24mm Optimal @BBL A1M 0.6 nozzle", + "sub_path": "process/0.24mm Optimal @BBL A1M 0.6 nozzle.json" + }, + { + "name": "0.36mm Standard @BBL X1C 0.6 nozzle", + "sub_path": "process/0.36mm Standard @BBL X1C 0.6 nozzle.json" + }, + { + "name": "0.36mm Draft @BBL A1M 0.6 nozzle", + "sub_path": "process/0.36mm Draft @BBL A1M 0.6 nozzle.json" + }, + { + "name": "0.42mm Standard @BBL X1C 0.6 nozzle", + "sub_path": "process/0.42mm Standard @BBL X1C 0.6 nozzle.json" + }, + { + "name": "0.42mm Extra Draft @BBL A1M 0.6 nozzle", + "sub_path": "process/0.42mm Extra Draft @BBL A1M 0.6 nozzle.json" + }, { "name": "0.24mm Standard @BBL X1C 0.8 nozzle", "sub_path": "process/0.24mm Standard @BBL X1C 0.8 nozzle.json" }, + { + "name": "0.24mm Fine @BBL A1M 0.8 nozzle", + "sub_path": "process/0.24mm Fine @BBL A1M 0.8 nozzle.json" + }, { "name": "0.32mm Standard @BBL X1C 0.8 nozzle", "sub_path": "process/0.32mm Standard @BBL X1C 0.8 nozzle.json" }, + { + "name": "0.32mm Optimal @BBL A1M 0.8 nozzle", + "sub_path": "process/0.32mm Optimal @BBL A1M 0.8 nozzle.json" + }, { "name": "0.48mm Standard @BBL X1C 0.8 nozzle", "sub_path": "process/0.48mm Standard @BBL X1C 0.8 nozzle.json" }, + { + "name": "0.48mm Draft @BBL A1M 0.8 nozzle", + "sub_path": "process/0.48mm Draft @BBL A1M 0.8 nozzle.json" + }, { "name": "0.56mm Standard @BBL X1C 0.8 nozzle", "sub_path": "process/0.56mm Standard @BBL X1C 0.8 nozzle.json" }, { - "name": "0.30mm Strength @BBL X1C 0.6 nozzle", - "sub_path": "process/0.30mm Strength @BBL X1C 0.6 nozzle.json" + "name": "0.56mm Extra Draft @BBL A1M 0.8 nozzle", + "sub_path": "process/0.56mm Extra Draft @BBL A1M 0.8 nozzle.json" + }, + { + "name": "0.10mm Standard @BBL A1M 0.2 nozzle", + "sub_path": "process/0.10mm Standard @BBL A1M 0.2 nozzle.json" + }, + { + "name": "0.40mm Standard @BBL A1M 0.8 nozzle", + "sub_path": "process/0.40mm Standard @BBL A1M 0.8 nozzle.json" + }, + { + "name": "0.30mm Standard @BBL A1M 0.6 nozzle", + "sub_path": "process/0.30mm Standard @BBL A1M 0.6 nozzle.json" + }, + { + "name": "0.20mm Standard @BBL A1M", + "sub_path": "process/0.20mm Standard @BBL A1M.json" + }, + { + "name": "0.20mm Strength @BBL A1M", + "sub_path": "process/0.20mm Strength @BBL A1M.json" } ], "filament_list": [ @@ -297,6 +393,14 @@ "name": "fdm_filament_hips", "sub_path": "filament/fdm_filament_hips.json" }, + { + "name": "fdm_filament_pps", + "sub_path": "filament/fdm_filament_pps.json" + }, + { + "name": "fdm_filament_ppa", + "sub_path": "filament/fdm_filament_ppa.json" + }, { "name": "Bambu PLA Matte @base", "sub_path": "filament/Bambu PLA Matte @base.json" @@ -493,6 +597,22 @@ "name": "Generic HIPS @base", "sub_path": "filament/Generic HIPS @base.json" }, + { + "name": "Generic PPS-CF @base", + "sub_path": "filament/Generic PPS-CF @base.json" + }, + { + "name": "Generic PPS @base", + "sub_path": "filament/Generic PPS @base.json" + }, + { + "name": "Generic PPA-CF @base", + "sub_path": "filament/Generic PPA-CF @base.json" + }, + { + "name": "Generic PPA-GF @base", + "sub_path": "filament/Generic PPA-GF @base.json" + }, { "name": "Bambu PLA Matte @BBL X1C", "sub_path": "filament/Bambu PLA Matte @BBL X1C.json" @@ -517,6 +637,14 @@ "name": "Bambu PLA Matte @BBL P1P", "sub_path": "filament/P1P/Bambu PLA Matte @BBL P1P.json" }, + { + "name": "Bambu PLA Matte @BBL A1M", + "sub_path": "filament/Bambu PLA Matte @BBL A1M.json" + }, + { + "name": "Bambu PLA Matte @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu PLA Matte @BBL A1M 0.2 nozzle.json" + }, { "name": "Bambu PLA Basic @BBL X1C", "sub_path": "filament/Bambu PLA Basic @BBL X1C.json" @@ -541,6 +669,14 @@ "name": "Bambu PLA Basic @BBL P1P", "sub_path": "filament/P1P/Bambu PLA Basic @BBL P1P.json" }, + { + "name": "Bambu PLA Basic @BBL A1M", + "sub_path": "filament/Bambu PLA Basic @BBL A1M.json" + }, + { + "name": "Bambu PLA Basic @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu PLA Basic @BBL A1M 0.2 nozzle.json" + }, { "name": "Bambu PLA Tough @BBL X1C", "sub_path": "filament/Bambu PLA Tough @BBL X1C.json" @@ -561,6 +697,14 @@ "name": "Bambu PLA Tough @BBL P1P", "sub_path": "filament/P1P/Bambu PLA Tough @BBL P1P.json" }, + { + "name": "Bambu PLA Tough @BBL A1M", + "sub_path": "filament/Bambu PLA Tough @BBL A1M.json" + }, + { + "name": "Bambu PLA Tough @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu PLA Tough @BBL A1M 0.2 nozzle.json" + }, { "name": "Bambu PLA Marble @BBL X1", "sub_path": "filament/Bambu PLA Marble @BBL X1.json" @@ -573,6 +717,10 @@ "name": "Bambu PLA Marble @BBL P1P", "sub_path": "filament/P1P/Bambu PLA Marble @BBL P1P.json" }, + { + "name": "Bambu PLA Marble @BBL A1M", + "sub_path": "filament/Bambu PLA Marble @BBL A1M.json" + }, { "name": "Bambu PLA Sparkle @BBL X1", "sub_path": "filament/Bambu PLA Sparkle @BBL X1.json" @@ -585,6 +733,10 @@ "name": "Bambu PLA Sparkle @BBL P1P", "sub_path": "filament/P1P/Bambu PLA Sparkle @BBL P1P.json" }, + { + "name": "Bambu PLA Sparkle @BBL A1M", + "sub_path": "filament/Bambu PLA Sparkle @BBL A1M.json" + }, { "name": "Bambu PLA Metal @BBL X1C 0.2 nozzle", "sub_path": "filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json" @@ -605,6 +757,14 @@ "name": "Bambu PLA Metal @BBL P1P", "sub_path": "filament/P1P/Bambu PLA Metal @BBL P1P.json" }, + { + "name": "Bambu PLA Metal @BBL A1M", + "sub_path": "filament/Bambu PLA Metal @BBL A1M.json" + }, + { + "name": "Bambu PLA Metal @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu PLA Metal @BBL A1M 0.2 nozzle.json" + }, { "name": "Bambu PLA Silk @BBL X1", "sub_path": "filament/Bambu PLA Silk @BBL X1.json" @@ -625,6 +785,14 @@ "name": "Bambu PLA Silk @BBL P1P 0.2 nozzle", "sub_path": "filament/P1P/Bambu PLA Silk @BBL P1P 0.2 nozzle.json" }, + { + "name": "Bambu PLA Silk @BBL A1M", + "sub_path": "filament/Bambu PLA Silk @BBL A1M.json" + }, + { + "name": "Bambu PLA Silk @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu PLA Silk @BBL A1M 0.2 nozzle.json" + }, { "name": "Bambu Support W @BBL X1C", "sub_path": "filament/Bambu Support W @BBL X1C.json" @@ -645,6 +813,14 @@ "name": "Bambu Support W @BBL P1P", "sub_path": "filament/P1P/Bambu Support W @BBL P1P.json" }, + { + "name": "Bambu Support W @BBL A1M", + "sub_path": "filament/Bambu Support W @BBL A1M.json" + }, + { + "name": "Bambu Support W @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu Support W @BBL A1M 0.2 nozzle.json" + }, { "name": "eSUN PLA+ @BBL X1C", "sub_path": "filament/eSUN PLA+ @BBL X1C.json" @@ -665,6 +841,14 @@ "name": "eSUN PLA+ @BBL P1P 0.2 nozzle", "sub_path": "filament/P1P/eSUN PLA+ @BBL P1P 0.2 nozzle.json" }, + { + "name": "eSUN PLA+ @BBL A1M", + "sub_path": "filament/eSUN PLA+ @BBL A1M.json" + }, + { + "name": "eSUN PLA+ @BBL A1M 0.2 nozzle", + "sub_path": "filament/eSUN PLA+ @BBL A1M 0.2 nozzle.json" + }, { "name": "PolyTerra PLA @BBL X1C", "sub_path": "filament/PolyTerra PLA @BBL X1C.json" @@ -677,6 +861,14 @@ "name": "PolyTerra PLA @BBL P1P", "sub_path": "filament/P1P/PolyTerra PLA @BBL P1P.json" }, + { + "name": "PolyTerra PLA @BBL A1M", + "sub_path": "filament/PolyTerra PLA @BBL A1M.json" + }, + { + "name": "PolyTerra PLA @BBL A1M 0.2 nozzle", + "sub_path": "filament/PolyTerra PLA @BBL A1M 0.2 nozzle.json" + }, { "name": "PolyLite PLA @BBL X1C", "sub_path": "filament/PolyLite PLA @BBL X1C.json" @@ -689,6 +881,14 @@ "name": "PolyLite PLA @BBL P1P", "sub_path": "filament/P1P/PolyLite PLA @BBL P1P.json" }, + { + "name": "PolyLite PLA @BBL A1M", + "sub_path": "filament/PolyLite PLA @BBL A1M.json" + }, + { + "name": "PolyLite PLA @BBL A1M 0.2 nozzle", + "sub_path": "filament/PolyLite PLA @BBL A1M 0.2 nozzle.json" + }, { "name": "Generic PLA", "sub_path": "filament/Generic PLA.json" @@ -705,6 +905,14 @@ "name": "Generic PLA @BBL P1P", "sub_path": "filament/P1P/Generic PLA @BBL P1P.json" }, + { + "name": "Generic PLA @BBL A1M", + "sub_path": "filament/Generic PLA @BBL A1M.json" + }, + { + "name": "Generic PLA @BBL A1M 0.2 nozzle", + "sub_path": "filament/Generic PLA @BBL A1M 0.2 nozzle.json" + }, { "name": "Generic PLA Silk", "sub_path": "filament/Generic PLA Silk.json" @@ -713,6 +921,10 @@ "name": "Generic PLA Silk @BBL P1P", "sub_path": "filament/P1P/Generic PLA Silk @BBL P1P.json" }, + { + "name": "Generic PLA Silk @BBL A1M", + "sub_path": "filament/Generic PLA Silk @BBL A1M.json" + }, { "name": "Generic PLA-CF", "sub_path": "filament/Generic PLA-CF.json" @@ -721,6 +933,10 @@ "name": "Generic PLA-CF @BBL P1P", "sub_path": "filament/P1P/Generic PLA-CF @BBL P1P.json" }, + { + "name": "Generic PLA-CF @BBL A1M", + "sub_path": "filament/Generic PLA-CF @BBL A1M.json" + }, { "name": "Bambu PLA-CF @BBL X1C 0.8 nozzle", "sub_path": "filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json" @@ -737,6 +953,14 @@ "name": "Bambu PLA-CF @BBL P1P 0.8 nozzle", "sub_path": "filament/P1P/Bambu PLA-CF @BBL P1P 0.8 nozzle.json" }, + { + "name": "Bambu PLA-CF @BBL A1M", + "sub_path": "filament/Bambu PLA-CF @BBL A1M.json" + }, + { + "name": "Bambu PLA-CF @BBL A1M 0.8 nozzle", + "sub_path": "filament/Bambu PLA-CF @BBL A1M 0.8 nozzle.json" + }, { "name": "Bambu Support For PLA @BBL X1C 0.2 nozzle", "sub_path": "filament/Bambu Support For PLA @BBL X1C 0.2 nozzle.json" @@ -753,6 +977,14 @@ "name": "Bambu Support For PLA @BBL P1P", "sub_path": "filament/P1P/Bambu Support For PLA @BBL P1P.json" }, + { + "name": "Bambu Support For PLA @BBL A1M", + "sub_path": "filament/Bambu Support For PLA @BBL A1M.json" + }, + { + "name": "Bambu Support For PLA @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu Support For PLA @BBL A1M 0.2 nozzle.json" + }, { "name": "Bambu PLA Aero @BBL X1", "sub_path": "filament/Bambu PLA Aero @BBL X1.json" @@ -765,6 +997,10 @@ "name": "Bambu PLA Aero @BBL P1P", "sub_path": "filament/P1P/Bambu PLA Aero @BBL P1P.json" }, + { + "name": "Bambu PLA Aero @BBL A1M", + "sub_path": "filament/Bambu PLA Aero @BBL A1M.json" + }, { "name": "Overture PLA @BBL X1C", "sub_path": "filament/Overture PLA @BBL X1C.json" @@ -777,6 +1013,10 @@ "name": "Overture PLA @BBL P1P", "sub_path": "filament/Overture PLA @BBL P1P.json" }, + { + "name": "Overture PLA @BBL A1M", + "sub_path": "filament/Overture PLA @BBL A1M.json" + }, { "name": "Overture Matte PLA @BBL X1C", "sub_path": "filament/Overture Matte PLA @BBL X1C.json" @@ -789,6 +1029,10 @@ "name": "Overture Matte PLA @BBL P1P", "sub_path": "filament/Overture Matte PLA @BBL P1P.json" }, + { + "name": "Overture Matte PLA @BBL A1M", + "sub_path": "filament/Overture Matte PLA @BBL A1M.json" + }, { "name": "Generic PLA High Speed @BBL X1C", "sub_path": "filament/Generic PLA High Speed @BBL X1C.json" @@ -797,6 +1041,10 @@ "name": "Generic PLA High Speed @BBL P1P", "sub_path": "filament/Generic PLA High Speed @BBL P1P.json" }, + { + "name": "Generic PLA High Speed @BBL A1M", + "sub_path": "filament/Generic PLA High Speed @BBL A1M.json" + }, { "name": "Bambu TPU 95A @BBL X1C", "sub_path": "filament/Bambu TPU 95A @BBL X1C.json" @@ -809,6 +1057,14 @@ "name": "Bambu TPU 95A @BBL P1P", "sub_path": "filament/P1P/Bambu TPU 95A @BBL P1P.json" }, + { + "name": "Bambu TPU 95A @BBL A1M", + "sub_path": "filament/Bambu TPU 95A @BBL A1M.json" + }, + { + "name": "Generic TPU @BBL A1M", + "sub_path": "filament/Generic TPU @BBL A1M.json" + }, { "name": "Bambu PETG Basic @BBL X1C", "sub_path": "filament/Bambu PETG Basic @BBL X1C.json" @@ -845,6 +1101,14 @@ "name": "Generic PETG @BBL P1P 0.2 nozzle", "sub_path": "filament/P1P/Generic PETG @BBL P1P 0.2 nozzle.json" }, + { + "name": "Generic PETG @BBL A1M", + "sub_path": "filament/Generic PETG @BBL A1M.json" + }, + { + "name": "Generic PETG @BBL A1M 0.2 nozzle", + "sub_path": "filament/Generic PETG @BBL A1M 0.2 nozzle.json" + }, { "name": "Generic PETG-CF @BBL X1C", "sub_path": "filament/Generic PETG-CF @BBL X1C.json" @@ -869,6 +1133,10 @@ "name": "Bambu PETG-CF @BBL P1P 0.4 nozzle", "sub_path": "filament/P1P/Bambu PETG-CF @BBL P1P 0.4 nozzle.json" }, + { + "name": "Bambu PETG-CF @BBL A1M", + "sub_path": "filament/Bambu PETG-CF @BBL A1M.json" + }, { "name": "PolyLite PETG @BBL X1C", "sub_path": "filament/PolyLite PETG @BBL X1C.json" @@ -877,6 +1145,10 @@ "name": "PolyLite PETG @BBL P1P", "sub_path": "filament/PolyLite PETG @BBL P1P.json" }, + { + "name": "PolyLite PETG @BBL A1M", + "sub_path": "filament/PolyLite PETG @BBL A1M.json" + }, { "name": "Bambu ABS @BBL X1C", "sub_path": "filament/Bambu ABS @BBL X1C.json" @@ -1021,6 +1293,14 @@ "name": "Generic PVA @BBL P1P", "sub_path": "filament/P1P/Generic PVA @BBL P1P.json" }, + { + "name": "Generic PVA @BBL A1M", + "sub_path": "filament/Generic PVA @BBL A1M.json" + }, + { + "name": "Generic PVA @BBL A1M 0.2 nozzle", + "sub_path": "filament/Generic PVA @BBL A1M 0.2 nozzle.json" + }, { "name": "Bambu Support G @BBL X1C", "sub_path": "filament/Bambu Support G @BBL X1C.json" @@ -1065,6 +1345,22 @@ "name": "Generic HIPS @BBL X1C 0.2 nozzle", "sub_path": "filament/Generic HIPS @BBL X1C 0.2 nozzle.json" }, + { + "name": "Generic HIPS @BBL A1M", + "sub_path": "filament/Generic HIPS @BBL A1M.json" + }, + { + "name": "Generic HIPS @BBL A1M 0.2 nozzle", + "sub_path": "filament/Generic HIPS @BBL A1M 0.2 nozzle.json" + }, + { + "name": "Generic PPA-CF @BBL X1C", + "sub_path": "filament/Generic PPA-CF @BBL X1C.json" + }, + { + "name": "Generic PPA-GF @BBL X1C", + "sub_path": "filament/Generic PPA-GF @BBL X1C.json" + }, { "name": "PolyTerra PLA @BBL X1C 0.2 nozzle", "sub_path": "filament/PolyTerra PLA @BBL X1C 0.2 nozzle.json" @@ -1089,6 +1385,10 @@ "name": "Overture PLA @BBL P1P 0.2 nozzle", "sub_path": "filament/Overture PLA @BBL P1P 0.2 nozzle.json" }, + { + "name": "Overture PLA @BBL A1M 0.2 nozzle", + "sub_path": "filament/Overture PLA @BBL A1M 0.2 nozzle.json" + }, { "name": "Overture Matte PLA @BBL X1C 0.2 nozzle", "sub_path": "filament/Overture Matte PLA @BBL X1C 0.2 nozzle.json" @@ -1097,6 +1397,10 @@ "name": "Overture Matte PLA @BBL P1P 0.2 nozzle", "sub_path": "filament/Overture Matte PLA @BBL P1P 0.2 nozzle.json" }, + { + "name": "Overture Matte PLA @BBL A1M 0.2 nozzle", + "sub_path": "filament/Overture Matte PLA @BBL A1M 0.2 nozzle.json" + }, { "name": "Generic PLA High Speed @BBL X1C 0.2 nozzle", "sub_path": "filament/Generic PLA High Speed @BBL X1C 0.2 nozzle.json" @@ -1105,6 +1409,30 @@ "name": "Generic PLA High Speed @BBL P1P 0.2 nozzle", "sub_path": "filament/Generic PLA High Speed @BBL P1P 0.2 nozzle.json" }, + { + "name": "Generic PLA High Speed @BBL A1M 0.2 nozzle", + "sub_path": "filament/Generic PLA High Speed @BBL A1M 0.2 nozzle.json" + }, + { + "name": "Bambu PETG Basic @BBL A1M 0.4 nozzle", + "sub_path": "filament/Bambu PETG Basic @BBL A1M 0.4 nozzle.json" + }, + { + "name": "Bambu PETG Basic @BBL A1M 0.2 nozzle", + "sub_path": "filament/Bambu PETG Basic @BBL A1M 0.2 nozzle.json" + }, + { + "name": "Bambu PETG Basic @BBL A1M 0.8 nozzle", + "sub_path": "filament/Bambu PETG Basic @BBL A1M 0.8 nozzle.json" + }, + { + "name": "Generic PETG-CF @BBL A1M", + "sub_path": "filament/P1P/Generic PETG-CF @BBL A1M.json" + }, + { + "name": "Bambu PETG-CF @BBL A1M 0.4 nozzle", + "sub_path": "filament/Bambu PETG-CF @BBL A1M 0.4 nozzle.json" + }, { "name": "PolyLite PETG @BBL X1C 0.2 nozzle", "sub_path": "filament/PolyLite PETG @BBL X1C 0.2 nozzle.json" @@ -1113,6 +1441,10 @@ "name": "PolyLite PETG @BBL P1P 0.2 nozzle", "sub_path": "filament/PolyLite PETG @BBL P1P 0.2 nozzle.json" }, + { + "name": "PolyLite PETG @BBL A1M 0.2 nozzle", + "sub_path": "filament/PolyLite PETG @BBL A1M 0.2 nozzle.json" + }, { "name": "PolyLite ABS @BBL X1C 0.2 nozzle", "sub_path": "filament/PolyLite ABS @BBL X1C 0.2 nozzle.json" @@ -1172,16 +1504,16 @@ "sub_path": "machine/Bambu Lab X1 0.4 nozzle.json" }, { - "name": "Bambu Lab X1 0.2 nozzle", - "sub_path": "machine/Bambu Lab X1 0.2 nozzle.json" + "name": "Bambu Lab P1P 0.4 nozzle", + "sub_path": "machine/Bambu Lab P1P 0.4 nozzle.json" }, { - "name": "Bambu Lab X1 0.8 nozzle", - "sub_path": "machine/Bambu Lab X1 0.8 nozzle.json" + "name": "Bambu Lab P1S 0.4 nozzle", + "sub_path": "machine/Bambu Lab P1S 0.4 nozzle.json" }, { - "name": "Bambu Lab X1 0.6 nozzle", - "sub_path": "machine/Bambu Lab X1 0.6 nozzle.json" + "name": "Bambu Lab A1 mini 0.4 nozzle", + "sub_path": "machine/Bambu Lab A1 mini 0.4 nozzle.json" }, { "name": "Bambu Lab X1 Carbon 0.2 nozzle", @@ -1196,8 +1528,16 @@ "sub_path": "machine/Bambu Lab X1 Carbon 0.8 nozzle.json" }, { - "name": "Bambu Lab P1P 0.4 nozzle", - "sub_path": "machine/Bambu Lab P1P 0.4 nozzle.json" + "name": "Bambu Lab X1 0.2 nozzle", + "sub_path": "machine/Bambu Lab X1 0.2 nozzle.json" + }, + { + "name": "Bambu Lab X1 0.8 nozzle", + "sub_path": "machine/Bambu Lab X1 0.8 nozzle.json" + }, + { + "name": "Bambu Lab X1 0.6 nozzle", + "sub_path": "machine/Bambu Lab X1 0.6 nozzle.json" }, { "name": "Bambu Lab P1P 0.2 nozzle", @@ -1211,10 +1551,6 @@ "name": "Bambu Lab P1P 0.8 nozzle", "sub_path": "machine/Bambu Lab P1P 0.8 nozzle.json" }, - { - "name": "Bambu Lab P1S 0.4 nozzle", - "sub_path": "machine/Bambu Lab P1S 0.4 nozzle.json" - }, { "name": "Bambu Lab P1S 0.2 nozzle", "sub_path": "machine/Bambu Lab P1S 0.2 nozzle.json" @@ -1226,6 +1562,18 @@ { "name": "Bambu Lab P1S 0.8 nozzle", "sub_path": "machine/Bambu Lab P1S 0.8 nozzle.json" + }, + { + "name": "Bambu Lab A1 mini 0.2 nozzle", + "sub_path": "machine/Bambu Lab A1 mini 0.2 nozzle.json" + }, + { + "name": "Bambu Lab A1 mini 0.6 nozzle", + "sub_path": "machine/Bambu Lab A1 mini 0.6 nozzle.json" + }, + { + "name": "Bambu Lab A1 mini 0.8 nozzle", + "sub_path": "machine/Bambu Lab A1 mini 0.8 nozzle.json" } ] } \ No newline at end of file diff --git a/resources/profiles/BBL/Bambu LAb A1 mini_cover.png b/resources/profiles/BBL/Bambu LAb A1 mini_cover.png new file mode 100644 index 000000000..f224e40b8 Binary files /dev/null and b/resources/profiles/BBL/Bambu LAb A1 mini_cover.png differ diff --git a/resources/web/image/printer/Bambu Lab P1P_cover.png b/resources/profiles/BBL/Bambu Lab P1P_cover.png similarity index 100% rename from resources/web/image/printer/Bambu Lab P1P_cover.png rename to resources/profiles/BBL/Bambu Lab P1P_cover.png diff --git a/resources/web/image/printer/Bambu Lab P1S_cover.png b/resources/profiles/BBL/Bambu Lab P1S_cover.png similarity index 100% rename from resources/web/image/printer/Bambu Lab P1S_cover.png rename to resources/profiles/BBL/Bambu Lab P1S_cover.png diff --git a/resources/web/image/printer/Bambu Lab X1 Carbon_cover.png b/resources/profiles/BBL/Bambu Lab X1 Carbon_cover.png similarity index 100% rename from resources/web/image/printer/Bambu Lab X1 Carbon_cover.png rename to resources/profiles/BBL/Bambu Lab X1 Carbon_cover.png diff --git a/resources/web/image/printer/Bambu Lab X1_cover.png b/resources/profiles/BBL/Bambu Lab X1_cover.png similarity index 100% rename from resources/web/image/printer/Bambu Lab X1_cover.png rename to resources/profiles/BBL/Bambu Lab X1_cover.png diff --git a/resources/profiles/BBL/bbl-3dp-A1M.stl b/resources/profiles/BBL/bbl-3dp-A1M.stl new file mode 100644 index 000000000..ccdc7982e Binary files /dev/null and b/resources/profiles/BBL/bbl-3dp-A1M.stl differ diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.2 nozzle.json index abc56a5fe..33b42423f 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB00_00", "name": "Bambu ABS @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu ABS @base", + "from": "system", + "setting_id": "GFSB00_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.8 nozzle.json index 0ff435196..5d7ee3e46 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C 0.8 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB00_01", "name": "Bambu ABS @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu ABS @base", + "from": "system", + "setting_id": "GFSB00_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "22" ], diff --git a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C.json b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C.json index a5c0875b0..563d6118c 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu ABS @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB00", "name": "Bambu ABS @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu ABS @base", + "from": "system", + "setting_id": "GFSB00", + "instantiation": "true", "filament_max_volumetric_speed": [ "22" ], diff --git a/resources/profiles/BBL/filament/Bambu ABS @base.json b/resources/profiles/BBL/filament/Bambu ABS @base.json index 011785259..a185e7cf8 100644 --- a/resources/profiles/BBL/filament/Bambu ABS @base.json +++ b/resources/profiles/BBL/filament/Bambu ABS @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFB00", "name": "Bambu ABS @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_abs", + "from": "system", + "filament_id": "GFB00", + "instantiation": "false", "filament_flow_ratio": [ "0.95" ], diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.2 nozzle.json index d2cd753b0..9f705b864 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.2 nozzle.json @@ -1,10 +1,10 @@ { - "name": "Bambu ASA @BBL X1 0.2 nozzle", "type": "filament", - "instantiation": "true", - "from": "system", + "name": "Bambu ASA @BBL X1 0.2 nozzle", "inherits": "Bambu ASA @base", + "from": "system", "setting_id": "GFSB01_03", + "instantiation": "true", "fan_max_speed": [ "80" ], diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.6 nozzle.json b/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.6 nozzle.json index adadbab3c..13b857c2d 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.6 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL X1 0.6 nozzle.json @@ -1,10 +1,10 @@ { - "name": "Bambu ASA @BBL X1 0.6 nozzle", "type": "filament", - "instantiation": "true", - "from": "system", + "name": "Bambu ASA @BBL X1 0.6 nozzle", "inherits": "Bambu ASA @base", + "from": "system", "setting_id": "GFSB01_04", + "instantiation": "true", "fan_max_speed": [ "90" ], diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.2 nozzle.json index 75d45b232..1253bff71 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.2 nozzle.json @@ -1,17 +1,16 @@ { - "name": "Bambu ASA @BBL X1C 0.2 nozzle", "type": "filament", - "instantiation": "true", - "from": "system", + "name": "Bambu ASA @BBL X1C 0.2 nozzle", "inherits": "Bambu ASA @base", + "from": "system", "setting_id": "GFSB01_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", - "Bambu Lab P1P 0.2 nozzle", - "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + "Bambu Lab P1S 0.2 nozzle", + "Bambu Lab P1P 0.2 nozzle" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.4 nozzle.json b/resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.4 nozzle.json index 619c35773..b3c53e095 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.4 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL X1C 0.4 nozzle.json @@ -1,16 +1,18 @@ { - "name": "Bambu ASA @BBL X1C 0.4 nozzle", "type": "filament", - "instantiation": "true", - "from": "system", + "name": "Bambu ASA @BBL X1C 0.4 nozzle", "inherits": "Bambu ASA @base", + "from": "system", "setting_id": "GFSB01_02", + "instantiation": "true", + "chamber_temperatures": [ + "60" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab P1S 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1P 0.4 nozzle", - "Bambu Lab P1P 0.8 nozzle", - "Bambu Lab P1S 0.4 nozzle" - ], - "version": "01.07.00.18" + "Bambu Lab P1P 0.8 nozzle" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json b/resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json index dac40dca8..5693a2c1d 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu ASA @BBL X1C.json @@ -1,10 +1,10 @@ { - "name": "Bambu ASA @BBL X1C", "type": "filament", - "instantiation": "true", - "from": "system", + "name": "Bambu ASA @BBL X1C", "inherits": "Bambu ASA @base", + "from": "system", "setting_id": "GFSB01_00", + "instantiation": "true", "fan_min_speed": [ "25" ], @@ -16,7 +16,7 @@ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", "Bambu Lab P1S 0.6 nozzle", - "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab P1P 0.6 nozzle" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu ASA @base.json b/resources/profiles/BBL/filament/Bambu ASA @base.json index f3c174af5..f2fc943a0 100644 --- a/resources/profiles/BBL/filament/Bambu ASA @base.json +++ b/resources/profiles/BBL/filament/Bambu ASA @base.json @@ -1,16 +1,16 @@ { - "name": "Bambu ASA @base", "type": "filament", - "instantiation": "false", - "from": "system", + "name": "Bambu ASA @base", "inherits": "fdm_filament_asa", + "from": "system", + "filament_id": "GFB01", + "instantiation": "false", "filament_density": [ "1.05" ], "filament_cost": [ "31.99" ], - "filament_id": "GFB01", "nozzle_temperature_initial_layer": [ "270" ], diff --git a/resources/profiles/BBL/filament/Bambu PA-CF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PA-CF @BBL X1C.json index e89a79dd0..6bafe958b 100644 --- a/resources/profiles/BBL/filament/Bambu PA-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PA-CF @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSN00", "name": "Bambu PA-CF @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PA-CF @base", + "from": "system", + "setting_id": "GFSN00", + "instantiation": "true", "nozzle_temperature_initial_layer": [ "290" ], diff --git a/resources/profiles/BBL/filament/Bambu PA-CF @base.json b/resources/profiles/BBL/filament/Bambu PA-CF @base.json index 98842dc10..2788ee1bd 100644 --- a/resources/profiles/BBL/filament/Bambu PA-CF @base.json +++ b/resources/profiles/BBL/filament/Bambu PA-CF @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFN03", "name": "Bambu PA-CF @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pa", + "from": "system", + "filament_id": "GFN03", + "instantiation": "false", "filament_cost": [ "84.99" ], diff --git a/resources/profiles/BBL/filament/Bambu PA6-CF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PA6-CF @BBL X1C.json index 53eaa6a22..3d81a495a 100644 --- a/resources/profiles/BBL/filament/Bambu PA6-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PA6-CF @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSN05_02", "name": "Bambu PA6-CF @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PA6-CF @base", + "from": "system", + "setting_id": "GFSN05_02", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", @@ -18,6 +18,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PA6-CF @base.json b/resources/profiles/BBL/filament/Bambu PA6-CF @base.json index 5fdacfe59..697101fff 100644 --- a/resources/profiles/BBL/filament/Bambu PA6-CF @base.json +++ b/resources/profiles/BBL/filament/Bambu PA6-CF @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFN05", "name": "Bambu PA6-CF @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pa", + "from": "system", + "filament_id": "GFN05", + "instantiation": "false", "fan_cooling_layer_time": [ "5" ], diff --git a/resources/profiles/BBL/filament/Bambu PAHT-CF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PAHT-CF @BBL X1C.json index 30e9b9fba..9dc4dd127 100644 --- a/resources/profiles/BBL/filament/Bambu PAHT-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PAHT-CF @BBL X1C.json @@ -1,10 +1,13 @@ { "type": "filament", - "setting_id": "GFSN04", "name": "Bambu PAHT-CF @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PAHT-CF @base", + "from": "system", + "setting_id": "GFSN04", + "instantiation": "true", + "chamber_temperatures": [ + "60" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu PAHT-CF @base.json b/resources/profiles/BBL/filament/Bambu PAHT-CF @base.json index 67182ecc5..0f5dcfb74 100644 --- a/resources/profiles/BBL/filament/Bambu PAHT-CF @base.json +++ b/resources/profiles/BBL/filament/Bambu PAHT-CF @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFN04", "name": "Bambu PAHT-CF @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pa", + "from": "system", + "filament_id": "GFN04", + "instantiation": "false", "fan_max_speed": [ "30" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.2 nozzle.json index 3b597c1b8..f3c0578cc 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_06", "name": "Bambu PC @BBL P1S 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @BBL X1C 0.2 nozzle", + "from": "system", + "setting_id": "GFSC00_06", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.6 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.6 nozzle.json index ea01e6836..8f7f5d7bd 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.6 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.6 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_08", "name": "Bambu PC @BBL P1S 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @BBL X1C 0.6 nozzle", + "from": "system", + "setting_id": "GFSC00_08", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.8 nozzle.json index 711931b94..36968d76f 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL P1S 0.8 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_07", "name": "Bambu PC @BBL P1S 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @BBL X1C 0.8 nozzle", + "from": "system", + "setting_id": "GFSC00_07", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL P1S.json b/resources/profiles/BBL/filament/Bambu PC @BBL P1S.json index 622626a09..327fab415 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL P1S.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL P1S.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_05", "name": "Bambu PC @BBL P1S", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @BBL X1C", + "from": "system", + "setting_id": "GFSC00_05", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.2 nozzle.json index c9e4e9b64..918c8c716 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_02", "name": "Bambu PC @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @base", + "from": "system", + "setting_id": "GFSC00_02", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.6 nozzle.json index 3e4097868..241a0704c 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.6 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_01", "name": "Bambu PC @BBL X1C 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @base", + "from": "system", + "setting_id": "GFSC00_01", + "instantiation": "true", "nozzle_temperature": [ "260" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.8 nozzle.json index 05cf7862c..f1108f988 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL X1C 0.8 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_00", "name": "Bambu PC @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @base", + "from": "system", + "setting_id": "GFSC00_00", + "instantiation": "true", "nozzle_temperature": [ "260" ], diff --git a/resources/profiles/BBL/filament/Bambu PC @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PC @BBL X1C.json index 3199f7c96..d59ce3cde 100644 --- a/resources/profiles/BBL/filament/Bambu PC @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PC @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00", "name": "Bambu PC @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @base", + "from": "system", + "setting_id": "GFSC00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle" diff --git a/resources/profiles/BBL/filament/Bambu PC @base.json b/resources/profiles/BBL/filament/Bambu PC @base.json index a9038a4b9..001f7c94d 100644 --- a/resources/profiles/BBL/filament/Bambu PC @base.json +++ b/resources/profiles/BBL/filament/Bambu PC @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFC00", "name": "Bambu PC @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pc", + "from": "system", + "filament_id": "GFC00", + "instantiation": "false", "filament_vendor": [ "Bambu Lab" ], diff --git a/resources/profiles/BBL/filament/Bambu PET-CF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PET-CF @BBL X1C.json index 0ab0cde98..ad1535f18 100644 --- a/resources/profiles/BBL/filament/Bambu PET-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PET-CF @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFST01", "name": "Bambu PET-CF @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PET-CF @base", + "from": "system", + "setting_id": "GFST01", + "instantiation": "true", "reduce_fan_stop_start_freq": [ "0" ], diff --git a/resources/profiles/BBL/filament/Bambu PET-CF @base.json b/resources/profiles/BBL/filament/Bambu PET-CF @base.json index a5aa8cc47..9cfc605c3 100644 --- a/resources/profiles/BBL/filament/Bambu PET-CF @base.json +++ b/resources/profiles/BBL/filament/Bambu PET-CF @base.json @@ -1,18 +1,24 @@ { "type": "filament", - "filament_id": "GFT01", "name": "Bambu PET-CF @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pet", - "temperature_vitrification": [ - "185" + "from": "system", + "filament_id": "GFT01", + "instantiation": "false", + "cool_plate_temp": [ + "0" ], - "overhang_fan_threshold": [ - "0%" + "cool_plate_temp_initial_layer": [ + "0" ], - "overhang_fan_speed": [ - "40" + "eng_plate_temp": [ + "80" + ], + "eng_plate_temp_initial_layer": [ + "80" + ], + "fan_cooling_layer_time": [ + "5" ], "fan_max_speed": [ "30" @@ -20,67 +26,61 @@ "fan_min_speed": [ "10" ], - "filament_max_volumetric_speed": [ - "8" - ], - "slow_down_layer_time": [ - "2" - ], - "fan_cooling_layer_time": [ - "5" - ], - "cool_plate_temp": [ - "0" - ], - "eng_plate_temp": [ - "80" - ], - "hot_plate_temp": [ - "100" - ], - "textured_plate_temp": [ - "100" - ], - "cool_plate_temp_initial_layer": [ - "0" - ], - "eng_plate_temp_initial_layer": [ - "80" - ], - "hot_plate_temp_initial_layer": [ - "100" - ], - "textured_plate_temp_initial_layer": [ - "100" - ], - "required_nozzle_HRC": [ - "40" - ], - "filament_vendor": [ - "Bambu Lab" - ], - "filament_type": [ - "PET-CF" - ], "filament_cost": [ "84.99" ], "filament_density": [ "1.29" ], - "nozzle_temperature_range_low": [ - "260" + "filament_max_volumetric_speed": [ + "8" ], - "nozzle_temperature_range_high": [ - "290" + "filament_type": [ + "PET-CF" ], - "nozzle_temperature_initial_layer": [ - "270" + "filament_vendor": [ + "Bambu Lab" + ], + "hot_plate_temp": [ + "100" + ], + "hot_plate_temp_initial_layer": [ + "100" ], "nozzle_temperature": [ "270" ], + "nozzle_temperature_initial_layer": [ + "270" + ], + "nozzle_temperature_range_high": [ + "290" + ], + "nozzle_temperature_range_low": [ + "260" + ], + "overhang_fan_speed": [ + "40" + ], + "overhang_fan_threshold": [ + "0%" + ], + "required_nozzle_HRC": [ + "40" + ], + "slow_down_layer_time": [ + "2" + ], + "temperature_vitrification": [ + "185" + ], + "textured_plate_temp": [ + "100" + ], + "textured_plate_temp_initial_layer": [ + "100" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..6553473d1 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.2 nozzle.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Bambu PETG Basic @BBL A1M 0.2 nozzle", + "inherits": "Bambu PETG Basic @BBL X1C 0.2 nozzle", + "from": "system", + "setting_id": "GFSG00_04", + "instantiation": "true", + "filament_flow_ratio": [ + "0.94" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.4 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.4 nozzle.json new file mode 100644 index 000000000..837e060fe --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.4 nozzle.json @@ -0,0 +1,17 @@ +{ + "type": "filament", + "name": "Bambu PETG Basic @BBL A1M 0.4 nozzle", + "inherits": "Bambu PETG Basic @BBL X1C", + "from": "system", + "setting_id": "GFSG00_03", + "instantiation": "true", + "filament_flow_ratio": [ + "0.94" + ], + "filament_max_volumetric_speed": [ + "9" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.8 nozzle.json new file mode 100644 index 000000000..e3d66863c --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL A1M 0.8 nozzle.json @@ -0,0 +1,18 @@ +{ + "type": "filament", + "name": "Bambu PETG Basic @BBL A1M 0.8 nozzle", + "inherits": "Bambu PETG Basic @BBL X1C 0.8 nozzle", + "from": "system", + "setting_id": "GFSG00_05", + "instantiation": "true", + "filament_flow_ratio": [ + "0.94" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.2 nozzle.json index 0016649ed..823bdc2c0 100644 --- a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG00_00", "name": "Bambu PETG Basic @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PETG Basic @base", + "from": "system", + "setting_id": "GFSG00_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.8 nozzle.json index 66d4c0ec6..f1144cca2 100644 --- a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C 0.8 nozzle.json @@ -1,19 +1,19 @@ { "type": "filament", - "setting_id": "GFSG00_02", "name": "Bambu PETG Basic @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PETG Basic @base", - "filament_max_volumetric_speed": [ - "16" - ], + "from": "system", + "setting_id": "GFSG00_02", + "instantiation": "true", "fan_max_speed": [ "60" ], "fan_min_speed": [ "20" ], + "filament_max_volumetric_speed": [ + "16" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C.json index 0c1248519..077f3736a 100644 --- a/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG00_01", "name": "Bambu PETG Basic @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PETG Basic @base", + "from": "system", + "setting_id": "GFSG00_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "13" ], diff --git a/resources/profiles/BBL/filament/Bambu PETG Basic @base.json b/resources/profiles/BBL/filament/Bambu PETG Basic @base.json index 4c0ccd83d..02ca4846f 100644 --- a/resources/profiles/BBL/filament/Bambu PETG Basic @base.json +++ b/resources/profiles/BBL/filament/Bambu PETG Basic @base.json @@ -1,18 +1,24 @@ { "type": "filament", - "filament_id": "GFG00", "name": "Bambu PETG Basic @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pet", - "filament_flow_ratio": [ - "0.95" + "from": "system", + "filament_id": "GFG00", + "instantiation": "false", + "cool_plate_temp": [ + "0" ], - "overhang_fan_speed": [ - "90" + "cool_plate_temp_initial_layer": [ + "0" ], - "overhang_fan_threshold": [ - "10%" + "eng_plate_temp": [ + "70" + ], + "eng_plate_temp_initial_layer": [ + "70" + ], + "fan_cooling_layer_time": [ + "30" ], "fan_max_speed": [ "40" @@ -20,52 +26,46 @@ "fan_min_speed": [ "10" ], - "filament_max_volumetric_speed": [ - "8" - ], - "fan_cooling_layer_time": [ - "30" - ], - "cool_plate_temp": [ - "0" - ], - "eng_plate_temp": [ - "70" - ], - "hot_plate_temp": [ - "70" - ], - "textured_plate_temp": [ - "70" - ], - "cool_plate_temp_initial_layer": [ - "0" - ], - "eng_plate_temp_initial_layer": [ - "70" - ], - "hot_plate_temp_initial_layer": [ - "70" - ], - "textured_plate_temp_initial_layer": [ - "70" - ], - "filament_vendor": [ - "Bambu Lab" - ], "filament_cost": [ "24.99" ], "filament_density": [ "1.25" ], - "nozzle_temperature_range_low": [ - "240" + "filament_flow_ratio": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "8" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" ], "nozzle_temperature_range_high": [ "270" ], + "nozzle_temperature_range_low": [ + "240" + ], + "overhang_fan_speed": [ + "90" + ], + "overhang_fan_threshold": [ + "10%" + ], + "textured_plate_temp": [ + "70" + ], + "textured_plate_temp_initial_layer": [ + "70" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PETG-CF @BBL A1M 0.4 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL A1M 0.4 nozzle.json new file mode 100644 index 000000000..4545a6f2a --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL A1M 0.4 nozzle.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Bambu PETG-CF @BBL A1M 0.4 nozzle", + "inherits": "Bambu PETG-CF @BBL A1M", + "from": "system", + "setting_id": "GFSG50_04", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "9" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PETG-CF @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL A1M.json new file mode 100644 index 000000000..a630c42d3 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL A1M.json @@ -0,0 +1,15 @@ +{ + "type": "filament", + "name": "Bambu PETG-CF @BBL A1M", + "inherits": "Bambu PETG-CF @base", + "from": "system", + "setting_id": "GFSG50_00", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "9" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C 0.4 nozzle.json b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C 0.4 nozzle.json index 0824fe7b8..f997cf536 100644 --- a/resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C 0.4 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C 0.4 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG50_02", "name": "Bambu PETG-CF @BBL X1C 0.4 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PETG-CF @base", + "from": "system", + "setting_id": "GFSG50_02", + "instantiation": "true", "filament_max_volumetric_speed": [ "13" ], diff --git a/resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C.json index a26cd492b..22c4caf10 100644 --- a/resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PETG-CF @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG50_01", "name": "Bambu PETG-CF @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PETG-CF @base", + "from": "system", + "setting_id": "GFSG50_01", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 Carbon 0.8 nozzle", @@ -12,6 +12,5 @@ "Bambu Lab X1 0.8 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PETG-CF @base.json b/resources/profiles/BBL/filament/Bambu PETG-CF @base.json index f0627b0f0..5263e7005 100644 --- a/resources/profiles/BBL/filament/Bambu PETG-CF @base.json +++ b/resources/profiles/BBL/filament/Bambu PETG-CF @base.json @@ -1,80 +1,80 @@ { "type": "filament", - "filament_id": "GFG50", "name": "Bambu PETG-CF @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pet", - "filament_flow_ratio": [ - "0.95" - ], - "temperature_vitrification": [ - "75" - ], - "overhang_fan_threshold": [ - "10%" - ], - "overhang_fan_speed": [ - "90" - ], + "from": "system", + "filament_id": "GFG50", + "instantiation": "false", "cool_plate_temp": [ "0" ], + "cool_plate_temp_initial_layer": [ + "0" + ], "eng_plate_temp": [ "70" ], - "hot_plate_temp": [ - "70" - ], - "textured_plate_temp": [ - "70" - ], - "cool_plate_temp_initial_layer": [ - "0" - ], "eng_plate_temp_initial_layer": [ "70" ], - "hot_plate_temp_initial_layer": [ - "70" - ], - "textured_plate_temp_initial_layer": [ - "70" - ], - "required_nozzle_HRC": [ - "40" - ], - "filament_vendor": [ - "Bambu Lab" - ], - "filament_type": [ - "PETG-CF" - ], - "nozzle_temperature_range_low": [ - "240" - ], - "nozzle_temperature_range_high": [ - "270" - ], - "filament_cost": [ - "34.99" - ], - "filament_density": [ - "1.25" - ], "fan_max_speed": [ "30" ], "fan_min_speed": [ "0" ], + "filament_cost": [ + "34.99" + ], + "filament_density": [ + "1.25" + ], + "filament_flow_ratio": [ + "0.95" + ], "filament_max_volumetric_speed": [ "14" ], + "filament_type": [ + "PETG-CF" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "nozzle_temperature_range_low": [ + "240" + ], + "overhang_fan_speed": [ + "90" + ], + "overhang_fan_threshold": [ + "10%" + ], + "required_nozzle_HRC": [ + "40" + ], "slow_down_layer_time": [ "6" ], + "temperature_vitrification": [ + "75" + ], + "textured_plate_temp": [ + "70" + ], + "textured_plate_temp_initial_layer": [ + "70" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Aero @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA Aero @BBL A1M.json new file mode 100644 index 000000000..6483f04f4 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Aero @BBL A1M.json @@ -0,0 +1,40 @@ +{ + "type": "filament", + "name": "Bambu PLA Aero @BBL A1M", + "inherits": "Bambu PLA Aero @base", + "from": "system", + "setting_id": "GFSA11_03", + "instantiation": "true", + "additional_cooling_fan_speed": [ + "0" + ], + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1.json index 525eafebb..1d03391c1 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1.json @@ -1,10 +1,13 @@ { - "name": "Bambu PLA Aero @BBL X1", "type": "filament", - "instantiation": "true", - "from": "system", + "name": "Bambu PLA Aero @BBL X1", "inherits": "Bambu PLA Aero @base", + "from": "system", "setting_id": "GFSA11_00", + "instantiation": "true", + "additional_cooling_fan_speed": [ + "0" + ], "slow_down_layer_time": [ "8" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1C.json index 6ff948fcd..b328eaef9 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Aero @BBL X1C.json @@ -1,12 +1,15 @@ { - "name": "Bambu PLA Aero @BBL X1C", "type": "filament", - "instantiation": "true", - "from": "system", + "name": "Bambu PLA Aero @BBL X1C", "inherits": "Bambu PLA Aero @base", + "from": "system", "setting_id": "GFSA11_01", + "instantiation": "true", + "additional_cooling_fan_speed": [ + "0" + ], "slow_down_layer_time": [ - "4" + "8" ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu PLA Aero @base.json b/resources/profiles/BBL/filament/Bambu PLA Aero @base.json index b5787ea31..95b26c279 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Aero @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Aero @base.json @@ -1,15 +1,12 @@ { "type": "filament", "name": "Bambu PLA Aero @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", + "from": "system", "filament_id": "GFA11", - "filament_type":[ - "PLA-AERO" - ], - "filament_flow_ratio": [ - "0.6" + "instantiation": "false", + "fan_min_speed": [ + "30" ], "filament_cost": [ "44.99" @@ -17,16 +14,25 @@ "filament_density": [ "1.21" ], + "filament_flow_ratio": [ + "0.6" + ], + "filament_max_volumetric_speed": [ + "6" + ], + "filament_type": [ + "PLA-AERO" + ], "filament_vendor": [ "Bambu Lab" ], - "nozzle_temperature_range_low": [ - "210" - ], "nozzle_temperature_range_high": [ "260" ], + "nozzle_temperature_range_low": [ + "210" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..c1a12b1c4 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "Bambu PLA Basic @BBL A1M 0.2 nozzle", + "inherits": "Bambu PLA Basic @base", + "from": "system", + "setting_id": "GFSA00_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "2" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL A1M.json new file mode 100644 index 000000000..85c54ef7d --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Bambu PLA Basic @BBL A1M", + "inherits": "Bambu PLA Basic @base", + "from": "system", + "setting_id": "GFSA00_02", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1.json index 2f2222cf6..eda7418d8 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA04", "name": "Bambu PLA Basic @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Basic @base", + "from": "system", + "setting_id": "GFSA04", + "instantiation": "true", "filament_max_volumetric_speed": [ "21" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json index 7ee46a61e..550f87bad 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA00_00", "name": "Bambu PLA Basic @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Basic @base", + "from": "system", + "setting_id": "GFSA00_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json index 25be2bc3e..dd99b1ec6 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C 0.8 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA00_01", "name": "Bambu PLA Basic @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Basic @base", + "from": "system", + "setting_id": "GFSA00_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "21" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C.json index 852fd3ed4..24fd44bb5 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA00", "name": "Bambu PLA Basic @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Basic @base", + "from": "system", + "setting_id": "GFSA00", + "instantiation": "true", "filament_max_volumetric_speed": [ "21" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Basic @base.json b/resources/profiles/BBL/filament/Bambu PLA Basic @base.json index ded3eb4eb..b975be47d 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Basic @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Basic @base.json @@ -1,23 +1,26 @@ { "type": "filament", - "filament_id": "GFA00", "name": "Bambu PLA Basic @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" - ], + "from": "system", + "filament_id": "GFA00", + "instantiation": "false", "filament_cost": [ "24.99" ], - "filament_flow_ratio": [ - "0.98" - ], "filament_density": [ "1.26" ], + "filament_flow_ratio": [ + "0.98" + ], + "filament_max_volumetric_speed": [ + "21" + ], + "filament_vendor": [ + "Bambu Lab" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Impact @base.json b/resources/profiles/BBL/filament/Bambu PLA Impact @base.json index cf7f860a5..7cdc6f3e4 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Impact @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Impact @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFA03", "name": "Bambu PLA Impact @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFA03", + "instantiation": "false", "filament_vendor": [ "Bambu Lab" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Marble @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA Marble @BBL A1M.json new file mode 100644 index 000000000..92dfae7b7 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Marble @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Bambu PLA Marble @BBL A1M", + "inherits": "Bambu PLA Marble @base", + "from": "system", + "setting_id": "GFSA07_02", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1.json index 31c9936e0..caacc8992 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA07_01", "name": "Bambu PLA Marble @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Marble @base", + "from": "system", + "setting_id": "GFSA07_01", + "instantiation": "true", "slow_down_layer_time": [ "8" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1C.json index d399304c5..d9f4d88b6 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Marble @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA07_00", "name": "Bambu PLA Marble @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Marble @base", + "from": "system", + "setting_id": "GFSA07_00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu PLA Marble @base.json b/resources/profiles/BBL/filament/Bambu PLA Marble @base.json index 47df38695..be77e7787 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Marble @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Marble @base.json @@ -1,13 +1,10 @@ { "type": "filament", - "filament_id": "GFA07", "name": "Bambu PLA Marble @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" - ], + "from": "system", + "filament_id": "GFA07", + "instantiation": "false", "filament_cost": [ "29.99" ], @@ -17,7 +14,10 @@ "filament_flow_ratio": [ "0.98" ], + "filament_vendor": [ + "Bambu Lab" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..d637a5e27 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "Bambu PLA Matte @BBL A1M 0.2 nozzle", + "inherits": "Bambu PLA Matte @base", + "from": "system", + "setting_id": "GFSA01_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "2" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL A1M.json new file mode 100644 index 000000000..c08d84529 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL A1M.json @@ -0,0 +1,40 @@ +{ + "type": "filament", + "name": "Bambu PLA Matte @BBL A1M", + "inherits": "Bambu PLA Matte @base", + "from": "system", + "setting_id": "GFSA01_02", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "22" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1.json index 15be4526e..55693a9e6 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA05", "name": "Bambu PLA Matte @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Matte @base", + "from": "system", + "setting_id": "GFSA05", + "instantiation": "true", "filament_max_volumetric_speed": [ "22" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json index 9cb548eb2..e24bebb2e 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA01_00", "name": "Bambu PLA Matte @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Matte @base", + "from": "system", + "setting_id": "GFSA01_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json index 249051bae..6c763a1f3 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C 0.8 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA01_01", "name": "Bambu PLA Matte @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Matte @base", + "from": "system", + "setting_id": "GFSA01_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "22" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C.json index 3451f4172..9cbf041c5 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA01", "name": "Bambu PLA Matte @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Matte @base", + "from": "system", + "setting_id": "GFSA01", + "instantiation": "true", "filament_max_volumetric_speed": [ "22" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Matte @base.json b/resources/profiles/BBL/filament/Bambu PLA Matte @base.json index 16e468681..a9a337c6a 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Matte @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Matte @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFA01", "name": "Bambu PLA Matte @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFA01", + "instantiation": "false", "filament_vendor": [ "Bambu Lab" ], @@ -18,6 +18,6 @@ "0.98" ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..b486490b0 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "Bambu PLA Metal @BBL A1M 0.2 nozzle", + "inherits": "Bambu PLA Metal @base", + "from": "system", + "setting_id": "GFSA02_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "2" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL A1M.json new file mode 100644 index 000000000..9b58508d5 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL A1M.json @@ -0,0 +1,40 @@ +{ + "type": "filament", + "name": "Bambu PLA Metal @BBL A1M", + "inherits": "Bambu PLA Metal @base", + "from": "system", + "setting_id": "GFSA02_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "21" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1.json index 1ce24d2e4..6e4e1bc84 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA02_02", "name": "Bambu PLA Metal @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Metal @base", + "from": "system", + "setting_id": "GFSA02_02", + "instantiation": "true", "filament_max_volumetric_speed": [ "21" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json index bc0e5ab29..531a7996a 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA02_01", "name": "Bambu PLA Metal @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Metal @base", + "from": "system", + "setting_id": "GFSA02_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C.json index ed8a13a36..7d53b0398 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Metal @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA02", "name": "Bambu PLA Metal @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Metal @base", + "from": "system", + "setting_id": "GFSA02", + "instantiation": "true", "filament_max_volumetric_speed": [ "21" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Metal @base.json b/resources/profiles/BBL/filament/Bambu PLA Metal @base.json index da916316e..77c81e4fb 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Metal @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Metal @base.json @@ -1,23 +1,23 @@ { "type": "filament", - "filament_id": "GFA02", "name": "Bambu PLA Metal @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" - ], + "from": "system", + "filament_id": "GFA02", + "instantiation": "false", "filament_cost": [ "29.99" ], - "filament_flow_ratio": [ - "0.98" - ], "filament_density": [ "1.25" ], + "filament_flow_ratio": [ + "0.98" + ], + "filament_vendor": [ + "Bambu Lab" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..19caa9c9e --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "Bambu PLA Silk @BBL A1M 0.2 nozzle", + "inherits": "Bambu PLA Silk @base", + "from": "system", + "setting_id": "GFSA05_04", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "2" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL A1M.json new file mode 100644 index 000000000..e85cca345 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Bambu PLA Silk @BBL A1M", + "inherits": "Bambu PLA Silk @base", + "from": "system", + "setting_id": "GFSA05_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1.json index ad0f3b934..f64b1a640 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA05_02", "name": "Bambu PLA Silk @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Silk @base", + "from": "system", + "setting_id": "GFSA05_02", + "instantiation": "true", "slow_down_layer_time": [ "8" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C 0.2 nozzle.json index e82bf4fb1..183a7c8b3 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA05_00", "name": "Bambu PLA Silk @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Silk @base", + "from": "system", + "setting_id": "GFSA05_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C.json index 968dd3b55..f377531c5 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Silk @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA05_01", "name": "Bambu PLA Silk @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Silk @base", + "from": "system", + "setting_id": "GFSA05_01", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu PLA Silk @base.json b/resources/profiles/BBL/filament/Bambu PLA Silk @base.json index a64a0c728..642f93961 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Silk @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Silk @base.json @@ -1,29 +1,29 @@ { "type": "filament", - "filament_id": "GFA05", "name": "Bambu PLA Silk @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" - ], - "filament_flow_ratio": [ - "0.98" + "from": "system", + "filament_id": "GFA05", + "instantiation": "false", + "filament_cost": [ + "29.99" ], "filament_density": [ "1.32" ], - "filament_cost": [ - "29.99" + "filament_flow_ratio": [ + "0.98" ], - "nozzle_temperature_initial_layer": [ - "230" + "filament_vendor": [ + "Bambu Lab" ], "nozzle_temperature": [ "230" ], + "nozzle_temperature_initial_layer": [ + "230" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL A1M.json new file mode 100644 index 000000000..d58554269 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Bambu PLA Sparkle @BBL A1M", + "inherits": "Bambu PLA Sparkle @base", + "from": "system", + "setting_id": "GFSA08_02", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1.json index cd53484b2..713cd589e 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA08_01", "name": "Bambu PLA Sparkle @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Sparkle @base", + "from": "system", + "setting_id": "GFSA08_01", + "instantiation": "true", "slow_down_layer_time": [ "8" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1C.json index 1794aaaf2..b07c3aa7c 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Sparkle @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA08_00", "name": "Bambu PLA Sparkle @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Sparkle @base", + "from": "system", + "setting_id": "GFSA08_00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu PLA Sparkle @base.json b/resources/profiles/BBL/filament/Bambu PLA Sparkle @base.json index 15f3acc7f..cd4ee94fd 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Sparkle @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Sparkle @base.json @@ -1,13 +1,10 @@ { "type": "filament", - "filament_id": "GFA08", "name": "Bambu PLA Sparkle @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" - ], + "from": "system", + "filament_id": "GFA08", + "instantiation": "false", "filament_cost": [ "29.99" ], @@ -17,7 +14,10 @@ "filament_flow_ratio": [ "0.98" ], + "filament_vendor": [ + "Bambu Lab" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..4f10cb0ed --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "Bambu PLA Tough @BBL A1M 0.2 nozzle", + "inherits": "Bambu PLA Tough @base", + "from": "system", + "setting_id": "GFSA09_04", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "2" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL A1M.json new file mode 100644 index 000000000..40b03fb52 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL A1M.json @@ -0,0 +1,40 @@ +{ + "type": "filament", + "name": "Bambu PLA Tough @BBL A1M", + "inherits": "Bambu PLA Tough @base", + "from": "system", + "setting_id": "GFSA09_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "21" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1.json b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1.json index 868256413..9be5bd1a4 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA09_01", "name": "Bambu PLA Tough @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Tough @base", + "from": "system", + "setting_id": "GFSA09_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "21" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C 0.2 nozzle.json index ef7b0d928..0e7ac9f33 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA09_00", "name": "Bambu PLA Tough @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Tough @base", + "from": "system", + "setting_id": "GFSA09_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C.json index 2b6884d03..f80379029 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA Tough @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA09_02", "name": "Bambu PLA Tough @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Tough @base", + "from": "system", + "setting_id": "GFSA09_02", + "instantiation": "true", "filament_max_volumetric_speed": [ "21" ], diff --git a/resources/profiles/BBL/filament/Bambu PLA Tough @base.json b/resources/profiles/BBL/filament/Bambu PLA Tough @base.json index 764386ed4..24168d6f1 100644 --- a/resources/profiles/BBL/filament/Bambu PLA Tough @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA Tough @base.json @@ -1,23 +1,23 @@ { "type": "filament", - "filament_id": "GFA09", "name": "Bambu PLA Tough @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" - ], + "from": "system", + "filament_id": "GFA09", + "instantiation": "false", "filament_cost": [ "28.99" ], - "filament_flow_ratio": [ - "0.98" - ], "filament_density": [ "1.26" ], + "filament_flow_ratio": [ + "0.98" + ], + "filament_vendor": [ + "Bambu Lab" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL A1M 0.8 nozzle.json new file mode 100644 index 000000000..9e6df67b9 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL A1M 0.8 nozzle.json @@ -0,0 +1,45 @@ +{ + "type": "filament", + "name": "Bambu PLA-CF @BBL A1M 0.8 nozzle", + "inherits": "Bambu PLA-CF @base", + "from": "system", + "setting_id": "GFSA50_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "18" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "nozzle_temperature": [ + "230" + ], + "nozzle_temperature_initial_layer": [ + "230" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL A1M.json b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL A1M.json new file mode 100644 index 000000000..8994c7d43 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL A1M.json @@ -0,0 +1,44 @@ +{ + "type": "filament", + "name": "Bambu PLA-CF @BBL A1M", + "inherits": "Bambu PLA-CF @base", + "from": "system", + "setting_id": "GFSA50_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "15" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "nozzle_temperature": [ + "230" + ], + "nozzle_temperature_initial_layer": [ + "230" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json index f42ba10f7..9b23b321e 100644 --- a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C 0.8 nozzle.json @@ -1,17 +1,17 @@ { "type": "filament", - "setting_id": "GFSA50_02", "name": "Bambu PLA-CF @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA-CF @base", + "from": "system", + "setting_id": "GFSA50_02", + "instantiation": "true", "filament_max_volumetric_speed": [ "18" ], - "nozzle_temperature_initial_layer": [ + "nozzle_temperature": [ "230" ], - "nozzle_temperature": [ + "nozzle_temperature_initial_layer": [ "230" ], "compatible_printers": [ diff --git a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C.json index 6fbc6544a..5d8275539 100644 --- a/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PLA-CF @BBL X1C.json @@ -1,17 +1,17 @@ { "type": "filament", - "setting_id": "GFSA50_01", "name": "Bambu PLA-CF @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA-CF @base", + "from": "system", + "setting_id": "GFSA50_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "15" ], - "nozzle_temperature_initial_layer": [ + "nozzle_temperature": [ "230" ], - "nozzle_temperature": [ + "nozzle_temperature_initial_layer": [ "230" ], "compatible_printers": [ diff --git a/resources/profiles/BBL/filament/Bambu PLA-CF @base.json b/resources/profiles/BBL/filament/Bambu PLA-CF @base.json index 763e2d070..3f356ae86 100644 --- a/resources/profiles/BBL/filament/Bambu PLA-CF @base.json +++ b/resources/profiles/BBL/filament/Bambu PLA-CF @base.json @@ -1,12 +1,12 @@ { "type": "filament", - "filament_id": "GFA50", "name": "Bambu PLA-CF @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" + "from": "system", + "filament_id": "GFA50", + "instantiation": "false", + "additional_cooling_fan_speed": [ + "0" ], "cool_plate_temp": [ "45" @@ -17,11 +17,23 @@ "filament_cost": [ "34.99" ], + "filament_density": [ + "1.22" + ], "filament_flow_ratio": [ "0.98" ], - "filament_density": [ - "1.22" + "filament_type": [ + "PLA-CF" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "nozzle_temperature_range_high": [ + "250" + ], + "nozzle_temperature_range_low": [ + "210" ], "required_nozzle_HRC": [ "40" @@ -29,19 +41,7 @@ "slow_down_layer_time": [ "8" ], - "nozzle_temperature_range_low": [ - "210" - ], - "nozzle_temperature_range_high": [ - "250" - ], - "additional_cooling_fan_speed": [ - "0" - ], - "filament_type": [ - "PLA-CF" - ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PA PET @BBL X1C.json b/resources/profiles/BBL/filament/Bambu Support For PA PET @BBL X1C.json index 1a772e5e5..6af8ea242 100644 --- a/resources/profiles/BBL/filament/Bambu Support For PA PET @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu Support For PA PET @BBL X1C.json @@ -1,10 +1,13 @@ { "type": "filament", - "setting_id": "GFSS03_00", "name": "Bambu Support For PA/PET @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support For PA/PET @base", + "from": "system", + "setting_id": "GFSS03_00", + "instantiation": "true", + "chamber_temperatures": [ + "60" + ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu Support For PA PET @base.json b/resources/profiles/BBL/filament/Bambu Support For PA PET @base.json index 1c41f14c7..7af6db4c1 100644 --- a/resources/profiles/BBL/filament/Bambu Support For PA PET @base.json +++ b/resources/profiles/BBL/filament/Bambu Support For PA PET @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFS03", "name": "Bambu Support For PA/PET @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pa", + "from": "system", + "filament_id": "GFS03", + "instantiation": "false", "required_nozzle_HRC": [ "3" ], diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu Support For PLA @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..f02e4de3c --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA @BBL A1M 0.2 nozzle.json @@ -0,0 +1,41 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA @BBL A1M 0.2 nozzle", + "inherits": "Bambu Support For PLA @base", + "from": "system", + "setting_id": "GFSS02_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "0.5" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "nozzle_temperature": [ + "240" + ], + "nozzle_temperature_initial_layer": [ + "240" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA @BBL A1M.json b/resources/profiles/BBL/filament/Bambu Support For PLA @BBL A1M.json new file mode 100644 index 000000000..4a73ea4ac --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support For PLA @BBL A1M.json @@ -0,0 +1,34 @@ +{ + "type": "filament", + "name": "Bambu Support For PLA @BBL A1M", + "inherits": "Bambu Support For PLA @base", + "from": "system", + "setting_id": "GFSS02_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu Support For PLA @BBL X1C 0.2 nozzle.json index 018ffbdd5..83348d12c 100644 --- a/resources/profiles/BBL/filament/Bambu Support For PLA @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu Support For PLA @BBL X1C 0.2 nozzle.json @@ -1,17 +1,17 @@ { "type": "filament", - "setting_id": "GFSS02_01", "name": "Bambu Support For PLA @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support For PLA @base", + "from": "system", + "setting_id": "GFSS02_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "0.5" ], - "nozzle_temperature_initial_layer": [ + "nozzle_temperature": [ "240" ], - "nozzle_temperature": [ + "nozzle_temperature_initial_layer": [ "240" ], "compatible_printers": [ diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA @BBL X1C.json b/resources/profiles/BBL/filament/Bambu Support For PLA @BBL X1C.json index b9c8e8a13..f7174fd69 100644 --- a/resources/profiles/BBL/filament/Bambu Support For PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu Support For PLA @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS02_02", "name": "Bambu Support For PLA @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support For PLA @base", + "from": "system", + "setting_id": "GFSS02_02", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu Support For PLA @base.json b/resources/profiles/BBL/filament/Bambu Support For PLA @base.json index e014c0013..75179145e 100644 --- a/resources/profiles/BBL/filament/Bambu Support For PLA @base.json +++ b/resources/profiles/BBL/filament/Bambu Support For PLA @base.json @@ -1,19 +1,10 @@ { "type": "filament", - "filament_id": "GFS02", "name": "Bambu Support For PLA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" - ], - "filament_density": [ - "1.30" - ], - "filament_is_support": [ - "1" - ], + "from": "system", + "filament_id": "GFS02", + "instantiation": "false", "cool_plate_temp": [ "40" ], @@ -23,10 +14,19 @@ "filament_cost": [ "69.98" ], + "filament_density": [ + "1.30" + ], + "filament_is_support": [ + "1" + ], + "filament_vendor": [ + "Bambu Lab" + ], "slow_down_layer_time": [ "8" ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support G @BBL X1C.json b/resources/profiles/BBL/filament/Bambu Support G @BBL X1C.json index ced4f2bfe..49bca7ce4 100644 --- a/resources/profiles/BBL/filament/Bambu Support G @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu Support G @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS01", "name": "Bambu Support G @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support G @base", + "from": "system", + "setting_id": "GFSS01", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu Support G @base.json b/resources/profiles/BBL/filament/Bambu Support G @base.json index bbc35bf60..1d72fe958 100644 --- a/resources/profiles/BBL/filament/Bambu Support G @base.json +++ b/resources/profiles/BBL/filament/Bambu Support G @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFS01", "name": "Bambu Support G @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pa", + "from": "system", + "filament_id": "GFS01", + "instantiation": "false", "required_nozzle_HRC": [ "3" ], diff --git a/resources/profiles/BBL/filament/Bambu Support W @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu Support W @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..96c226d8e --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support W @BBL A1M 0.2 nozzle.json @@ -0,0 +1,41 @@ +{ + "type": "filament", + "name": "Bambu Support W @BBL A1M 0.2 nozzle", + "inherits": "Bambu Support W @base", + "from": "system", + "setting_id": "GFSS00_02", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "0.5" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "nozzle_temperature": [ + "240" + ], + "nozzle_temperature_initial_layer": [ + "240" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support W @BBL A1M.json b/resources/profiles/BBL/filament/Bambu Support W @BBL A1M.json new file mode 100644 index 000000000..51efafdcc --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu Support W @BBL A1M.json @@ -0,0 +1,34 @@ +{ + "type": "filament", + "name": "Bambu Support W @BBL A1M", + "inherits": "Bambu Support W @base", + "from": "system", + "setting_id": "GFSS00_01", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support W @BBL X1.json b/resources/profiles/BBL/filament/Bambu Support W @BBL X1.json index ea65cb4c4..3d00718f7 100644 --- a/resources/profiles/BBL/filament/Bambu Support W @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu Support W @BBL X1.json @@ -1,14 +1,13 @@ { "type": "filament", - "setting_id": "GFSS02", "name": "Bambu Support W @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support W @base", + "from": "system", + "setting_id": "GFSS02", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu Support W @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Bambu Support W @BBL X1C 0.2 nozzle.json index 846495d92..88946ead4 100644 --- a/resources/profiles/BBL/filament/Bambu Support W @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Bambu Support W @BBL X1C 0.2 nozzle.json @@ -1,17 +1,17 @@ { "type": "filament", - "setting_id": "GFSS00_00", "name": "Bambu Support W @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support W @base", + "from": "system", + "setting_id": "GFSS00_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "0.5" ], - "nozzle_temperature_initial_layer": [ + "nozzle_temperature": [ "240" ], - "nozzle_temperature": [ + "nozzle_temperature_initial_layer": [ "240" ], "compatible_printers": [ diff --git a/resources/profiles/BBL/filament/Bambu Support W @BBL X1C.json b/resources/profiles/BBL/filament/Bambu Support W @BBL X1C.json index d6f9346e1..ae911eb44 100644 --- a/resources/profiles/BBL/filament/Bambu Support W @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu Support W @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS00", "name": "Bambu Support W @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support W @base", + "from": "system", + "setting_id": "GFSS00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/Bambu Support W @base.json b/resources/profiles/BBL/filament/Bambu Support W @base.json index e6efbd3c4..63f7acebc 100644 --- a/resources/profiles/BBL/filament/Bambu Support W @base.json +++ b/resources/profiles/BBL/filament/Bambu Support W @base.json @@ -1,19 +1,10 @@ { "type": "filament", - "filament_id": "GFS00", "name": "Bambu Support W @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Bambu Lab" - ], - "filament_density": [ - "1.30" - ], - "filament_is_support": [ - "1" - ], + "from": "system", + "filament_id": "GFS00", + "instantiation": "false", "cool_plate_temp": [ "40" ], @@ -23,10 +14,19 @@ "filament_cost": [ "69.98" ], + "filament_density": [ + "1.30" + ], + "filament_is_support": [ + "1" + ], + "filament_vendor": [ + "Bambu Lab" + ], "slow_down_layer_time": [ "8" ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu TPU 95A @BBL A1M.json b/resources/profiles/BBL/filament/Bambu TPU 95A @BBL A1M.json new file mode 100644 index 000000000..eefb04f27 --- /dev/null +++ b/resources/profiles/BBL/filament/Bambu TPU 95A @BBL A1M.json @@ -0,0 +1,28 @@ +{ + "type": "filament", + "name": "Bambu TPU 95A @BBL A1M", + "inherits": "Bambu TPU 95A @base", + "from": "system", + "setting_id": "GFSU01_00", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "3.6" + ], + "hot_plate_temp": [ + "30" + ], + "hot_plate_temp_initial_layer": [ + "30" + ], + "textured_plate_temp": [ + "30" + ], + "textured_plate_temp_initial_layer": [ + "30" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1.json b/resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1.json index c45bcca8c..262594652 100644 --- a/resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1.json +++ b/resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSU01", "name": "Bambu TPU 95A @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Bambu TPU 95A @base", + "from": "system", + "setting_id": "GFSU01", + "instantiation": "true", "filament_max_volumetric_speed": [ "3.6" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1C.json b/resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1C.json index b5535d246..7fb782f73 100644 --- a/resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu TPU 95A @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSU00", "name": "Bambu TPU 95A @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Bambu TPU 95A @base", + "from": "system", + "setting_id": "GFSU00", + "instantiation": "true", "filament_max_volumetric_speed": [ "3.6" ], diff --git a/resources/profiles/BBL/filament/Bambu TPU 95A @base.json b/resources/profiles/BBL/filament/Bambu TPU 95A @base.json index 507386fb5..bc1e83934 100644 --- a/resources/profiles/BBL/filament/Bambu TPU 95A @base.json +++ b/resources/profiles/BBL/filament/Bambu TPU 95A @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFU01", "name": "Bambu TPU 95A @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_tpu", + "from": "system", + "filament_id": "GFU01", + "instantiation": "false", "filament_vendor": [ "Bambu Lab" ], diff --git a/resources/profiles/BBL/filament/Generic ABS @0.2 nozzle.json b/resources/profiles/BBL/filament/Generic ABS @0.2 nozzle.json index 59971c21a..4a80f63ef 100644 --- a/resources/profiles/BBL/filament/Generic ABS @0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic ABS @0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB99_00", "name": "Generic ABS @0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic ABS @base", + "from": "system", + "setting_id": "GFSB99_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Generic ABS @base.json b/resources/profiles/BBL/filament/Generic ABS @base.json index 044703f6a..e41b289fb 100644 --- a/resources/profiles/BBL/filament/Generic ABS @base.json +++ b/resources/profiles/BBL/filament/Generic ABS @base.json @@ -1,14 +1,14 @@ { "type": "filament", - "filament_id": "GFB99", "name": "Generic ABS @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_abs", + "from": "system", + "filament_id": "GFB99", + "instantiation": "false", "filament_flow_ratio": [ "0.95" ], "filament_max_volumetric_speed": [ "16" ] -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic ABS.json b/resources/profiles/BBL/filament/Generic ABS.json index 6602737aa..e21fbe34e 100644 --- a/resources/profiles/BBL/filament/Generic ABS.json +++ b/resources/profiles/BBL/filament/Generic ABS.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB99", "name": "Generic ABS", - "from": "system", - "instantiation": "true", "inherits": "Generic ABS @base", + "from": "system", + "setting_id": "GFSB99", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/Generic ASA @0.2 nozzle.json b/resources/profiles/BBL/filament/Generic ASA @0.2 nozzle.json index 1c274d1e2..7c24aa123 100644 --- a/resources/profiles/BBL/filament/Generic ASA @0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic ASA @0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB98_00", "name": "Generic ASA @0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic ASA @base", + "from": "system", + "setting_id": "GFSB98_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/Generic ASA @base.json b/resources/profiles/BBL/filament/Generic ASA @base.json index 10ed89183..9f80b36f1 100644 --- a/resources/profiles/BBL/filament/Generic ASA @base.json +++ b/resources/profiles/BBL/filament/Generic ASA @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFB98", "name": "Generic ASA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_asa", + "from": "system", + "filament_id": "GFB98", + "instantiation": "false", "filament_flow_ratio": [ "0.95" ], diff --git a/resources/profiles/BBL/filament/Generic ASA.json b/resources/profiles/BBL/filament/Generic ASA.json index 4196ac210..e5c9d0300 100644 --- a/resources/profiles/BBL/filament/Generic ASA.json +++ b/resources/profiles/BBL/filament/Generic ASA.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB98", "name": "Generic ASA", - "from": "system", - "instantiation": "true", "inherits": "Generic ASA @base", + "from": "system", + "setting_id": "GFSB98", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/Generic HIPS @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic HIPS @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..a2200be03 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic HIPS @BBL A1M 0.2 nozzle.json @@ -0,0 +1,32 @@ +{ + "type": "filament", + "name": "Generic HIPS @BBL A1M 0.2 nozzle", + "inherits": "Generic HIPS @base", + "from": "system", + "setting_id": "GFSS98_03", + "instantiation": "true", + "eng_plate_temp": [ + "70" + ], + "eng_plate_temp_initial_layer": [ + "70" + ], + "filament_max_volumetric_speed": [ + "0.5" + ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" + ], + "textured_plate_temp": [ + "70" + ], + "textured_plate_temp_initial_layer": [ + "70" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic HIPS @BBL A1M.json b/resources/profiles/BBL/filament/Generic HIPS @BBL A1M.json new file mode 100644 index 000000000..11c1000c2 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic HIPS @BBL A1M.json @@ -0,0 +1,31 @@ +{ + "type": "filament", + "name": "Generic HIPS @BBL A1M", + "inherits": "Generic HIPS @base", + "from": "system", + "setting_id": "GFSS98_02", + "instantiation": "true", + "eng_plate_temp": [ + "70" + ], + "eng_plate_temp_initial_layer": [ + "70" + ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" + ], + "textured_plate_temp": [ + "70" + ], + "textured_plate_temp_initial_layer": [ + "70" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic HIPS @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic HIPS @BBL X1C 0.2 nozzle.json index 49134d244..ea504f770 100644 --- a/resources/profiles/BBL/filament/Generic HIPS @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic HIPS @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS98_01", "name": "Generic HIPS @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic HIPS @base", + "from": "system", + "setting_id": "GFSS98_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "0.5" ], @@ -13,6 +13,5 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1P 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic HIPS @BBL X1C.json b/resources/profiles/BBL/filament/Generic HIPS @BBL X1C.json index 92608bb4d..cf3280305 100644 --- a/resources/profiles/BBL/filament/Generic HIPS @BBL X1C.json +++ b/resources/profiles/BBL/filament/Generic HIPS @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS98_00", "name": "Generic HIPS @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Generic HIPS @base", + "from": "system", + "setting_id": "GFSS98_00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", @@ -18,6 +18,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic HIPS @base.json b/resources/profiles/BBL/filament/Generic HIPS @base.json index 030daa118..9ffe6a859 100644 --- a/resources/profiles/BBL/filament/Generic HIPS @base.json +++ b/resources/profiles/BBL/filament/Generic HIPS @base.json @@ -1,14 +1,11 @@ { - "type": "filament", - "filament_id": "GFS98", - "name": "Generic HIPS @base", - "from": "system", - "instantiation": "false", - "inherits": "fdm_filament_hips", - "filament_vendor": [ - "Generic" - ], - "filament_is_support": [ - "1" - ] + "type": "filament", + "name": "Generic HIPS @base", + "inherits": "fdm_filament_hips", + "from": "system", + "filament_id": "GFS98", + "instantiation": "false", + "filament_is_support": [ + "1" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PA-CF.json b/resources/profiles/BBL/filament/Generic PA-CF.json index dd1c485e0..5ce9881f8 100644 --- a/resources/profiles/BBL/filament/Generic PA-CF.json +++ b/resources/profiles/BBL/filament/Generic PA-CF.json @@ -1,11 +1,11 @@ { "type": "filament", + "name": "Generic PA-CF", + "inherits": "fdm_filament_pa", + "from": "system", "filament_id": "GFN98", "setting_id": "GFSN99", - "name": "Generic PA-CF", - "from": "system", "instantiation": "true", - "inherits": "fdm_filament_pa", "fan_cooling_layer_time": [ "5" ], @@ -40,6 +40,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PA.json b/resources/profiles/BBL/filament/Generic PA.json index f8d714fd9..f3a9b8aca 100644 --- a/resources/profiles/BBL/filament/Generic PA.json +++ b/resources/profiles/BBL/filament/Generic PA.json @@ -1,22 +1,25 @@ { "type": "filament", + "name": "Generic PA", + "inherits": "fdm_filament_pa", + "from": "system", "filament_id": "GFN99", "setting_id": "GFSN98", - "name": "Generic PA", - "from": "system", "instantiation": "true", - "inherits": "fdm_filament_pa", - "required_nozzle_HRC": [ - "3" + "chamber_temperatures": [ + "60" ], - "nozzle_temperature_initial_layer": [ - "280" + "filament_max_volumetric_speed": [ + "16" ], "nozzle_temperature": [ "280" ], - "filament_max_volumetric_speed": [ - "16" + "nozzle_temperature_initial_layer": [ + "280" + ], + "required_nozzle_HRC": [ + "3" ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/Generic PC @0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PC @0.2 nozzle.json index 11e8f5d3e..02cb9401b 100644 --- a/resources/profiles/BBL/filament/Generic PC @0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic PC @0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC99_00", "name": "Generic PC @0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PC @base", + "from": "system", + "setting_id": "GFSC99_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], diff --git a/resources/profiles/BBL/filament/Generic PC @BBL P1S 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PC @BBL P1S 0.2 nozzle.json index 6eaf2c133..bc0a5e565 100644 --- a/resources/profiles/BBL/filament/Generic PC @BBL P1S 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic PC @BBL P1S 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC99_03", "name": "Generic PC @BBL P1S 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PC @0.2 nozzle", + "from": "system", + "setting_id": "GFSC99_03", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Generic PC @BBL P1S.json b/resources/profiles/BBL/filament/Generic PC @BBL P1S.json index 5ea0e3409..204fbcfee 100644 --- a/resources/profiles/BBL/filament/Generic PC @BBL P1S.json +++ b/resources/profiles/BBL/filament/Generic PC @BBL P1S.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC99_04", "name": "Generic PC @BBL P1S", - "from": "system", - "instantiation": "true", "inherits": "Generic PC", + "from": "system", + "setting_id": "GFSC99_04", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/Generic PC @base.json b/resources/profiles/BBL/filament/Generic PC @base.json index b51b60889..6c56650ba 100644 --- a/resources/profiles/BBL/filament/Generic PC @base.json +++ b/resources/profiles/BBL/filament/Generic PC @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFC99", "name": "Generic PC @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pc", + "from": "system", + "filament_id": "GFC99", + "instantiation": "false", "filament_max_volumetric_speed": [ "16" ], diff --git a/resources/profiles/BBL/filament/Generic PC.json b/resources/profiles/BBL/filament/Generic PC.json index 377f4885f..6e8cbc2c6 100644 --- a/resources/profiles/BBL/filament/Generic PC.json +++ b/resources/profiles/BBL/filament/Generic PC.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC99", "name": "Generic PC", - "from": "system", - "instantiation": "true", "inherits": "Generic PC @base", + "from": "system", + "setting_id": "GFSC99", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", @@ -12,6 +12,5 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PETG @0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PETG @0.2 nozzle.json index 46fbc4df6..68aa6330b 100644 --- a/resources/profiles/BBL/filament/Generic PETG @0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic PETG @0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG99_01", "name": "Generic PETG @0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PETG @base", + "from": "system", + "setting_id": "GFSG99_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], diff --git a/resources/profiles/BBL/filament/Generic PETG @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PETG @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..7abc1a065 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PETG @BBL A1M 0.2 nozzle.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PETG @BBL A1M 0.2 nozzle", + "inherits": "Generic PETG @base", + "from": "system", + "setting_id": "GFSG99_02", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "1" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PETG @BBL A1M.json b/resources/profiles/BBL/filament/Generic PETG @BBL A1M.json new file mode 100644 index 000000000..83ce33ee7 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PETG @BBL A1M.json @@ -0,0 +1,16 @@ +{ + "type": "filament", + "name": "Generic PETG @BBL A1M", + "inherits": "Generic PETG @base", + "from": "system", + "setting_id": "GFSG99_00", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "8" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PETG @base.json b/resources/profiles/BBL/filament/Generic PETG @base.json index 2308488ea..6e25c129f 100644 --- a/resources/profiles/BBL/filament/Generic PETG @base.json +++ b/resources/profiles/BBL/filament/Generic PETG @base.json @@ -1,51 +1,54 @@ { "type": "filament", - "filament_id": "GFG99", "name": "Generic PETG @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pet", + "from": "system", + "filament_id": "GFG99", + "instantiation": "false", + "cool_plate_temp": [ + "0" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp": [ + "70" + ], + "eng_plate_temp_initial_layer": [ + "70" + ], "fan_cooling_layer_time": [ "30" ], - "overhang_fan_speed": [ - "90" - ], - "overhang_fan_threshold": [ - "10%" - ], "fan_max_speed": [ "90" ], "fan_min_speed": [ "40" ], - "slow_down_min_speed": [ - "20" - ], "filament_flow_ratio": [ "0.95" ], "filament_max_volumetric_speed": [ "12" ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" + ], "nozzle_temperature_range_high": [ "270" ], - "cool_plate_temp": [ - "0" + "overhang_fan_speed": [ + "90" ], - "eng_plate_temp": [ - "70" + "overhang_fan_threshold": [ + "10%" ], - "cool_plate_temp_initial_layer": [ - "0" - ], - "eng_plate_temp_initial_layer": [ - "70" - ], - "hot_plate_temp": [ - "70" + "slow_down_min_speed": [ + "20" ], "textured_plate_temp": [ "70" @@ -53,10 +56,7 @@ "textured_plate_temp_initial_layer": [ "70" ], - "hot_plate_temp_initial_layer": [ - "70" - ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PETG-CF @BBL X1C.json b/resources/profiles/BBL/filament/Generic PETG-CF @BBL X1C.json index 7bd57db6e..cd1ddd978 100644 --- a/resources/profiles/BBL/filament/Generic PETG-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Generic PETG-CF @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG50", "name": "Generic PETG-CF @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Generic PETG-CF @base", + "from": "system", + "setting_id": "GFSG50", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", @@ -15,6 +15,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PETG-CF @base.json b/resources/profiles/BBL/filament/Generic PETG-CF @base.json index c4c96b813..c794c3566 100644 --- a/resources/profiles/BBL/filament/Generic PETG-CF @base.json +++ b/resources/profiles/BBL/filament/Generic PETG-CF @base.json @@ -1,80 +1,80 @@ { "type": "filament", - "filament_id": "GFG98", "name": "Generic PETG-CF @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pet", - "filament_flow_ratio": [ - "0.95" - ], - "temperature_vitrification": [ - "75" - ], - "overhang_fan_threshold": [ - "10%" - ], - "overhang_fan_speed": [ - "90" - ], + "from": "system", + "filament_id": "GFG98", + "instantiation": "false", "cool_plate_temp": [ "0" ], + "cool_plate_temp_initial_layer": [ + "0" + ], "eng_plate_temp": [ "70" ], - "hot_plate_temp": [ - "70" - ], - "textured_plate_temp": [ - "70" - ], - "cool_plate_temp_initial_layer": [ - "0" - ], "eng_plate_temp_initial_layer": [ "70" ], - "hot_plate_temp_initial_layer": [ - "70" - ], - "textured_plate_temp_initial_layer": [ - "70" - ], - "required_nozzle_HRC": [ - "40" - ], - "filament_vendor": [ - "Bambu Lab" - ], - "filament_type": [ - "PETG-CF" - ], - "nozzle_temperature_range_low": [ - "240" - ], - "nozzle_temperature_range_high": [ - "270" - ], - "filament_cost": [ - "34.99" - ], - "filament_density": [ - "1.25" - ], "fan_max_speed": [ "30" ], "fan_min_speed": [ "0" ], + "filament_cost": [ + "34.99" + ], + "filament_density": [ + "1.25" + ], + "filament_flow_ratio": [ + "0.95" + ], "filament_max_volumetric_speed": [ "12" ], + "filament_type": [ + "PETG-CF" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "hot_plate_temp": [ + "70" + ], + "hot_plate_temp_initial_layer": [ + "70" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "nozzle_temperature_range_low": [ + "240" + ], + "overhang_fan_speed": [ + "90" + ], + "overhang_fan_threshold": [ + "10%" + ], + "required_nozzle_HRC": [ + "40" + ], "slow_down_layer_time": [ "6" ], - "filament_start_gcode":[ - "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}" + "temperature_vitrification": [ + "75" + ], + "textured_plate_temp": [ + "70" + ], + "textured_plate_temp_initial_layer": [ + "70" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >80)||(bed_temperature_initial_layer[current_extruder] >80)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >60)||(bed_temperature_initial_layer[current_extruder] >60)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PETG.json b/resources/profiles/BBL/filament/Generic PETG.json index 4ccbffb53..8e2b6dcd6 100644 --- a/resources/profiles/BBL/filament/Generic PETG.json +++ b/resources/profiles/BBL/filament/Generic PETG.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG99", "name": "Generic PETG", - "from": "system", - "instantiation": "true", "inherits": "Generic PETG @base", + "from": "system", + "setting_id": "GFSG99", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/Generic PLA @0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PLA @0.2 nozzle.json index da55b3cb0..734c0d5fa 100644 --- a/resources/profiles/BBL/filament/Generic PLA @0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic PLA @0.2 nozzle.json @@ -1,20 +1,19 @@ { "type": "filament", - "setting_id": "GFSL99_00", "name": "Generic PLA @0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PLA @base", + "from": "system", + "setting_id": "GFSL99_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], - "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" - ], "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" ], - "version": "01.07.00.18" + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PLA @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..79d1f2150 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PLA @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "Generic PLA @BBL A1M 0.2 nozzle", + "inherits": "Generic PLA @base", + "from": "system", + "setting_id": "GFSL99_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "2" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA @BBL A1M.json b/resources/profiles/BBL/filament/Generic PLA @BBL A1M.json new file mode 100644 index 000000000..84bbaa9e1 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PLA @BBL A1M.json @@ -0,0 +1,34 @@ +{ + "type": "filament", + "name": "Generic PLA @BBL A1M", + "inherits": "Generic PLA @base", + "from": "system", + "setting_id": "GFSL99_02", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA @base.json b/resources/profiles/BBL/filament/Generic PLA @base.json index 43e3ff2f6..904cef4da 100644 --- a/resources/profiles/BBL/filament/Generic PLA @base.json +++ b/resources/profiles/BBL/filament/Generic PLA @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFL99", "name": "Generic PLA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFL99", + "instantiation": "false", "filament_flow_ratio": [ "0.98" ], @@ -12,6 +12,6 @@ "8" ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif};Prevent PLA from jamming" + "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif};Prevent PLA from jamming\n\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..b043e5265 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL A1M 0.2 nozzle.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Generic PLA High Speed @BBL A1M 0.2 nozzle", + "inherits": "Generic PLA High Speed @BBL A1M", + "from": "system", + "setting_id": "GFSL95_07", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "2" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL A1M.json b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL A1M.json new file mode 100644 index 000000000..069747358 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Generic PLA High Speed @BBL A1M", + "inherits": "Generic PLA High Speed @base", + "from": "system", + "setting_id": "GFSL95_06", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "6" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle", + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P 0.2 nozzle.json index 349be3047..a96bb2613 100644 --- a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P 0.2 nozzle.json @@ -10,6 +10,5 @@ ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P.json b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P.json index dbf139368..a1750a1a1 100644 --- a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P.json +++ b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL P1P.json @@ -27,6 +27,5 @@ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C 0.2 nozzle.json index 2a1ac23ef..b5312c39f 100644 --- a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C 0.2 nozzle.json @@ -12,6 +12,5 @@ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json index 2ae8c726f..ca0e526bd 100644 --- a/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json +++ b/resources/profiles/BBL/filament/Generic PLA High Speed @BBL X1C.json @@ -18,6 +18,5 @@ "Bambu Lab X1 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA Silk @BBL A1M.json b/resources/profiles/BBL/filament/Generic PLA Silk @BBL A1M.json new file mode 100644 index 000000000..ba7582a9e --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PLA Silk @BBL A1M.json @@ -0,0 +1,40 @@ +{ + "type": "filament", + "name": "Generic PLA Silk @BBL A1M", + "inherits": "Generic PLA Silk @base", + "from": "system", + "setting_id": "GFSL96_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "7.5" + ], + "filament_retraction_length": [ + "0.5" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA Silk @base.json b/resources/profiles/BBL/filament/Generic PLA Silk @base.json index 456b9a6fa..60ac1d46f 100644 --- a/resources/profiles/BBL/filament/Generic PLA Silk @base.json +++ b/resources/profiles/BBL/filament/Generic PLA Silk @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFL96", "name": "Generic PLA Silk @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFL96", + "instantiation": "false", "filament_flow_ratio": [ "0.98" ], @@ -12,6 +12,6 @@ "8" ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif};Prevent PLA from jamming" + "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif};Prevent PLA from jamming\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA Silk.json b/resources/profiles/BBL/filament/Generic PLA Silk.json index decb00ab7..eaf82c9da 100644 --- a/resources/profiles/BBL/filament/Generic PLA Silk.json +++ b/resources/profiles/BBL/filament/Generic PLA Silk.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL99_01", "name": "Generic PLA Silk", - "from": "system", - "instantiation": "true", "inherits": "Generic PLA Silk @base", + "from": "system", + "setting_id": "GFSL99_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "7.5" ], diff --git a/resources/profiles/BBL/filament/Generic PLA-CF @BBL A1M.json b/resources/profiles/BBL/filament/Generic PLA-CF @BBL A1M.json new file mode 100644 index 000000000..b8438ffee --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PLA-CF @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Generic PLA-CF @BBL A1M", + "inherits": "Generic PLA-CF @base", + "from": "system", + "setting_id": "GFSL98_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA-CF @base.json b/resources/profiles/BBL/filament/Generic PLA-CF @base.json index 1055ec990..597bdd6e2 100644 --- a/resources/profiles/BBL/filament/Generic PLA-CF @base.json +++ b/resources/profiles/BBL/filament/Generic PLA-CF @base.json @@ -1,12 +1,12 @@ { "type": "filament", - "filament_id": "GFL98", "name": "Generic PLA-CF @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "required_nozzle_HRC": [ - "40" + "from": "system", + "filament_id": "GFL98", + "instantiation": "false", + "additional_cooling_fan_speed": [ + "0" ], "cool_plate_temp": [ "45" @@ -20,13 +20,13 @@ "filament_type": [ "PLA-CF" ], + "required_nozzle_HRC": [ + "40" + ], "slow_down_layer_time": [ "7" ], - "additional_cooling_fan_speed": [ - "0" - ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA-CF.json b/resources/profiles/BBL/filament/Generic PLA-CF.json index eadc8b157..d1c4a8e9b 100644 --- a/resources/profiles/BBL/filament/Generic PLA-CF.json +++ b/resources/profiles/BBL/filament/Generic PLA-CF.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL98", "name": "Generic PLA-CF", - "from": "system", - "instantiation": "true", "inherits": "Generic PLA-CF @base", + "from": "system", + "setting_id": "GFSL98", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", @@ -15,6 +15,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PLA.json b/resources/profiles/BBL/filament/Generic PLA.json index a98d62ce5..800947d83 100644 --- a/resources/profiles/BBL/filament/Generic PLA.json +++ b/resources/profiles/BBL/filament/Generic PLA.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL99", "name": "Generic PLA", - "from": "system", - "instantiation": "true", "inherits": "Generic PLA @base", + "from": "system", + "setting_id": "GFSL99", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", @@ -17,7 +17,6 @@ "Bambu Lab P1S 0.8 nozzle" ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" - ], - "version": "01.07.00.18" + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PPA-CF @BBL X1C.json b/resources/profiles/BBL/filament/Generic PPA-CF @BBL X1C.json new file mode 100644 index 000000000..2df7f1525 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PPA-CF @BBL X1C.json @@ -0,0 +1,25 @@ +{ + "type": "filament", + "name": "Generic PPA-CF @BBL X1C", + "inherits": "Generic PPA-CF @base", + "from": "system", + "setting_id": "GFSN97_00", + "instantiation": "true", + "filament_type": [ + "PPA-CF" + ], + "compatible_printers": [ + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PPA-CF @base.json b/resources/profiles/BBL/filament/Generic PPA-CF @base.json new file mode 100644 index 000000000..1e642929b --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PPA-CF @base.json @@ -0,0 +1,17 @@ +{ + "type": "filament", + "name": "Generic PPA-CF @base", + "inherits": "fdm_filament_ppa", + "from": "system", + "filament_id": "GFN97", + "instantiation": "false", + "filament_max_volumetric_speed": [ + "6" + ], + "filament_type": [ + "PPA-CF" + ], + "filament_vendor": [ + "Generic" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PPA-GF @BBL X1C.json b/resources/profiles/BBL/filament/Generic PPA-GF @BBL X1C.json new file mode 100644 index 000000000..39cd2763d --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PPA-GF @BBL X1C.json @@ -0,0 +1,31 @@ +{ + "type": "filament", + "name": "Generic PPA-GF @BBL X1C", + "inherits": "Generic PPA-GF @base", + "from": "system", + "setting_id": "GFSN96_00", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "8" + ], + "filament_type": [ + "PPA-GF" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "compatible_printers": [ + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1S 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PPA-GF @base.json b/resources/profiles/BBL/filament/Generic PPA-GF @base.json new file mode 100644 index 000000000..2d95e3f5c --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PPA-GF @base.json @@ -0,0 +1,17 @@ +{ + "type": "filament", + "name": "Generic PPA-GF @base", + "inherits": "fdm_filament_ppa", + "from": "system", + "filament_id": "GFN96", + "instantiation": "false", + "filament_max_volumetric_speed": [ + "6" + ], + "filament_type": [ + "PPA-GF" + ], + "filament_vendor": [ + "Generic" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PPS @base.json b/resources/profiles/BBL/filament/Generic PPS @base.json new file mode 100644 index 000000000..7fa708bae --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PPS @base.json @@ -0,0 +1,8 @@ +{ + "type": "filament", + "name": "Generic PPS @base", + "inherits": "fdm_filament_pps", + "from": "system", + "filament_id": "GFT97", + "instantiation": "false" +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PPS-CF @base.json b/resources/profiles/BBL/filament/Generic PPS-CF @base.json new file mode 100644 index 000000000..887d276e2 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PPS-CF @base.json @@ -0,0 +1,29 @@ +{ + "type": "filament", + "name": "Generic PPS-CF @base", + "inherits": "fdm_filament_pps", + "from": "system", + "filament_id": "GFT98", + "instantiation": "false", + "fan_max_speed": [ + "30" + ], + "filament_density": [ + "1.3" + ], + "filament_max_volumetric_speed": [ + "3" + ], + "filament_type": [ + "PPS-CF" + ], + "nozzle_temperature_range_high": [ + "350" + ], + "required_nozzle_HRC": [ + "40" + ], + "temperature_vitrification": [ + "220" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PVA @0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PVA @0.2 nozzle.json index 6438b3753..68e95e5f0 100644 --- a/resources/profiles/BBL/filament/Generic PVA @0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Generic PVA @0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS99_00", "name": "Generic PVA @0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PVA @base", + "from": "system", + "setting_id": "GFSS99_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "0.5" ], diff --git a/resources/profiles/BBL/filament/Generic PVA @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Generic PVA @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..d57e6fd72 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PVA @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "Generic PVA @BBL A1M 0.2 nozzle", + "inherits": "Generic PVA @base", + "from": "system", + "setting_id": "GFSS99_02", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "0.5" + ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PVA @BBL A1M.json b/resources/profiles/BBL/filament/Generic PVA @BBL A1M.json new file mode 100644 index 000000000..fa3e91526 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic PVA @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Generic PVA @BBL A1M", + "inherits": "Generic PVA @base", + "from": "system", + "setting_id": "GFSS99_01", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle", + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic PVA @base.json b/resources/profiles/BBL/filament/Generic PVA @base.json index e472d0284..c29671ea3 100644 --- a/resources/profiles/BBL/filament/Generic PVA @base.json +++ b/resources/profiles/BBL/filament/Generic PVA @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFS99", "name": "Generic PVA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pva", + "from": "system", + "filament_id": "GFS99", + "instantiation": "false", "filament_flow_ratio": [ "0.95" ], diff --git a/resources/profiles/BBL/filament/Generic PVA.json b/resources/profiles/BBL/filament/Generic PVA.json index 4caebc3f3..786030268 100644 --- a/resources/profiles/BBL/filament/Generic PVA.json +++ b/resources/profiles/BBL/filament/Generic PVA.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS99", "name": "Generic PVA", - "from": "system", - "instantiation": "true", "inherits": "Generic PVA @base", + "from": "system", + "setting_id": "GFSS99", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/Generic TPU @BBL A1M.json b/resources/profiles/BBL/filament/Generic TPU @BBL A1M.json new file mode 100644 index 000000000..d5caa5640 --- /dev/null +++ b/resources/profiles/BBL/filament/Generic TPU @BBL A1M.json @@ -0,0 +1,28 @@ +{ + "type": "filament", + "name": "Generic TPU @BBL A1M", + "inherits": "Generic TPU", + "from": "system", + "setting_id": "GFSU99_00", + "instantiation": "true", + "hot_plate_temp": [ + "30" + ], + "hot_plate_temp_initial_layer": [ + "30" + ], + "textured_plate_temp": [ + "30" + ], + "textured_plate_temp_initial_layer": [ + "30" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif} \n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Generic TPU.json b/resources/profiles/BBL/filament/Generic TPU.json index 4dea613b4..b8b689644 100644 --- a/resources/profiles/BBL/filament/Generic TPU.json +++ b/resources/profiles/BBL/filament/Generic TPU.json @@ -1,17 +1,14 @@ { "type": "filament", + "name": "Generic TPU", + "inherits": "fdm_filament_tpu", + "from": "system", "filament_id": "GFU99", "setting_id": "GFSR99", - "name": "Generic TPU", - "from": "system", "instantiation": "true", - "inherits": "fdm_filament_tpu", "filament_max_volumetric_speed": [ "3.2" ], - "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif}" - ], "compatible_printers": [ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", @@ -23,5 +20,7 @@ "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" ], - "version": "01.07.00.18" + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif} \n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..dd372d83b --- /dev/null +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL A1M 0.2 nozzle.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Overture Matte PLA @BBL A1M 0.2 nozzle", + "inherits": "Overture Matte PLA @BBL A1M", + "from": "system", + "setting_id": "GFSL05_06", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "1" + ], + "compatible_printers": [ + "Bambu Lab P1P 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL A1M.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL A1M.json new file mode 100644 index 000000000..0e6e727a3 --- /dev/null +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Overture Matte PLA @BBL A1M", + "inherits": "Overture Matte PLA @base", + "from": "system", + "setting_id": "GFSL05_05", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.8 nozzle", + "Bambu Lab A1 mini 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P 0.2 nozzle.json index 1233076ac..8b51a32b0 100644 --- a/resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P 0.2 nozzle.json @@ -10,6 +10,5 @@ ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P.json index 2ca075af1..634f7ef0a 100644 --- a/resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P.json +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL P1P.json @@ -30,6 +30,5 @@ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json index 3c906f170..cedb6ba84 100644 --- a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL05_02", "name": "Overture Matte PLA @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Overture Matte PLA @base", + "from": "system", + "setting_id": "GFSL05_02", + "instantiation": "true", "slow_down_layer_time": [ "10" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle", "Bambu Lab X1 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C 0.2 nozzle.json index 44fddb610..75e17fe8c 100644 --- a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL05_01", "name": "Overture Matte PLA @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Overture Matte PLA @BBL X1C", + "from": "system", + "setting_id": "GFSL05_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json index cf3b4dea1..421c52ff8 100644 --- a/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/Overture Matte PLA @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL05_00", "name": "Overture Matte PLA @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Overture Matte PLA @base", + "from": "system", + "setting_id": "GFSL05_00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", @@ -12,6 +12,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture Matte PLA @base.json b/resources/profiles/BBL/filament/Overture Matte PLA @base.json index e833c9ae3..b4e2e3748 100644 --- a/resources/profiles/BBL/filament/Overture Matte PLA @base.json +++ b/resources/profiles/BBL/filament/Overture Matte PLA @base.json @@ -1,16 +1,19 @@ { "type": "filament", - "filament_id": "GFL05", "name": "Overture Matte PLA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFL05", + "instantiation": "false", "filament_cost": [ "24.52" ], "filament_density": [ "1.22" ], + "filament_flow_ratio": [ + "0.98" + ], "filament_max_volumetric_speed": [ "16" ], diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/Overture PLA @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..5a705c4a0 --- /dev/null +++ b/resources/profiles/BBL/filament/Overture PLA @BBL A1M 0.2 nozzle.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "Overture PLA @BBL A1M 0.2 nozzle", + "inherits": "Overture PLA @BBL A1M", + "from": "system", + "setting_id": "GFSL04_06", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "1" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL A1M.json b/resources/profiles/BBL/filament/Overture PLA @BBL A1M.json new file mode 100644 index 000000000..851864ce0 --- /dev/null +++ b/resources/profiles/BBL/filament/Overture PLA @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "Overture PLA @BBL A1M", + "inherits": "Overture PLA @base", + "from": "system", + "setting_id": "GFSL04_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/Overture PLA @BBL P1P 0.2 nozzle.json index 05994a7f8..f8de6aa19 100644 --- a/resources/profiles/BBL/filament/Overture PLA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Overture PLA @BBL P1P 0.2 nozzle.json @@ -10,6 +10,5 @@ ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL P1P.json b/resources/profiles/BBL/filament/Overture PLA @BBL P1P.json index a7b857782..d1d0e4af7 100644 --- a/resources/profiles/BBL/filament/Overture PLA @BBL P1P.json +++ b/resources/profiles/BBL/filament/Overture PLA @BBL P1P.json @@ -18,6 +18,5 @@ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL X1.json b/resources/profiles/BBL/filament/Overture PLA @BBL X1.json index f4138b2f8..c36384a9e 100644 --- a/resources/profiles/BBL/filament/Overture PLA @BBL X1.json +++ b/resources/profiles/BBL/filament/Overture PLA @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL04_01", "name": "Overture PLA @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "Overture PLA @base", + "from": "system", + "setting_id": "GFSL04_01", + "instantiation": "true", "slow_down_layer_time": [ "10" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.8 nozzle", "Bambu Lab X1 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/Overture PLA @BBL X1C 0.2 nozzle.json index 4025bb9eb..d8e4eb511 100644 --- a/resources/profiles/BBL/filament/Overture PLA @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/Overture PLA @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL04_02", "name": "Overture PLA @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Overture PLA @BBL X1C", + "from": "system", + "setting_id": "GFSL04_02", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @BBL X1C.json b/resources/profiles/BBL/filament/Overture PLA @BBL X1C.json index 1079ec06c..28e21b831 100644 --- a/resources/profiles/BBL/filament/Overture PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/Overture PLA @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL04_05", "name": "Overture PLA @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "Overture PLA @base", + "from": "system", + "setting_id": "GFSL04_05", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", @@ -12,6 +12,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/Overture PLA @base.json b/resources/profiles/BBL/filament/Overture PLA @base.json index cf33af039..7a4ce113b 100644 --- a/resources/profiles/BBL/filament/Overture PLA @base.json +++ b/resources/profiles/BBL/filament/Overture PLA @base.json @@ -1,16 +1,19 @@ { "type": "filament", - "filament_id": "GFL04", "name": "Overture PLA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFL04", + "instantiation": "false", "filament_cost": [ "24.15" ], "filament_density": [ "1.2" ], + "filament_flow_ratio": [ + "0.98" + ], "filament_max_volumetric_speed": [ "15" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P 0.2 nozzle.json index eaeaeed16..46229515e 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P 0.2 nozzle.json @@ -1,10 +1,13 @@ { "type": "filament", - "setting_id": "GFSB00_02", "name": "Bambu ABS @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu ABS @base", + "from": "system", + "setting_id": "GFSB00_02", + "instantiation": "true", + "fan_max_speed": [ + "20" + ], "filament_max_volumetric_speed": [ "2" ], @@ -14,18 +17,15 @@ "hot_plate_temp_initial_layer": [ "100" ], + "reduce_fan_stop_start_freq": [ + "0" + ], "textured_plate_temp": [ "100" ], "textured_plate_temp_initial_layer": [ "100" ], - "fan_max_speed": [ - "20" - ], - "reduce_fan_stop_start_freq": [ - "0" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P.json index 4251860aa..baece427b 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu ABS @BBL P1P.json @@ -1,18 +1,15 @@ { "type": "filament", - "setting_id": "GFSB00_03", "name": "Bambu ABS @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu ABS @base", - "filament_max_volumetric_speed": [ - "22" - ], + "from": "system", + "setting_id": "GFSB00_03", + "instantiation": "true", "fan_max_speed": [ "20" ], - "reduce_fan_stop_start_freq": [ - "0" + "filament_max_volumetric_speed": [ + "22" ], "hot_plate_temp": [ "100" @@ -20,6 +17,9 @@ "hot_plate_temp_initial_layer": [ "100" ], + "reduce_fan_stop_start_freq": [ + "0" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PA-CF @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PA-CF @BBL P1P.json index 2cbc77785..4271016a9 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PA-CF @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PA-CF @BBL P1P.json @@ -1,15 +1,12 @@ { "type": "filament", - "setting_id": "GFSN00_10", "name": "Bambu PA-CF @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PA-CF @base", - "nozzle_temperature_initial_layer": [ - "290" - ], - "nozzle_temperature": [ - "290" + "from": "system", + "setting_id": "GFSN00_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "5" ], "fan_max_speed": [ "30" @@ -17,12 +14,15 @@ "fan_min_speed": [ "10" ], - "fan_cooling_layer_time": [ - "5" - ], "full_fan_speed_layer": [ "2" ], + "nozzle_temperature": [ + "290" + ], + "nozzle_temperature_initial_layer": [ + "290" + ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PAHT-CF @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PAHT-CF @BBL P1P.json index 4f4629859..5771a889d 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PAHT-CF @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PAHT-CF @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSN04_10", "name": "Bambu PAHT-CF @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PAHT-CF @base", + "from": "system", + "setting_id": "GFSN04_10", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P 0.2 nozzle.json index 5be4ad168..d2d945525 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_03", "name": "Bambu PC @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @base", + "from": "system", + "setting_id": "GFSC00_03", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P.json index 56d71597a..42a54e789 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PC @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC00_04", "name": "Bambu PC @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PC @base", + "from": "system", + "setting_id": "GFSC00_04", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PET-CF @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PET-CF @BBL P1P.json index b3928f04a..68364628d 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PET-CF @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PET-CF @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFST01_10", "name": "Bambu PET-CF @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PET-CF @base", + "from": "system", + "setting_id": "GFST01_10", + "instantiation": "true", "reduce_fan_stop_start_freq": [ "0" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PETG-CF @BBL P1P 0.4 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PETG-CF @BBL P1P 0.4 nozzle.json index 8c99b497c..cf9e5b052 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PETG-CF @BBL P1P 0.4 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PETG-CF @BBL P1P 0.4 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG50_03", "name": "Bambu PETG-CF @BBL P1P 0.4 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PETG-CF @base", + "from": "system", + "setting_id": "GFSG50_03", + "instantiation": "true", "filament_max_volumetric_speed": [ "13" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PETG-CF @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PETG-CF @BBL P1P.json index c86e47ac5..b60020e27 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PETG-CF @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PETG-CF @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG50_11", "name": "Bambu PETG-CF @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PETG-CF @base", + "from": "system", + "setting_id": "GFSG50_11", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Aero @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Aero @BBL P1P.json index e0fba9d63..4f475196e 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Aero @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Aero @BBL P1P.json @@ -1,31 +1,31 @@ { - "name": "Bambu PLA Aero @BBL P1P", "type": "filament", - "instantiation": "true", - "from": "system", + "name": "Bambu PLA Aero @BBL P1P", "inherits": "Bambu PLA Aero @base", + "from": "system", "setting_id": "GFSA11_02", - "hot_plate_temp_initial_layer": [ - "65" - ], - "hot_plate_temp": [ - "65" - ], - "textured_plate_temp_initial_layer": [ - "65" - ], - "textured_plate_temp": [ - "65" - ], - "fan_min_speed": [ - "50" + "instantiation": "true", + "additional_cooling_fan_speed": [ + "0" ], "fan_cooling_layer_time": [ "80" ], + "hot_plate_temp": [ + "65" + ], + "hot_plate_temp_initial_layer": [ + "65" + ], "slow_down_layer_time": [ "8" ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Basic @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Basic @BBL P1P 0.2 nozzle.json index ef06b387d..8aecb2d59 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Basic @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Basic @BBL P1P 0.2 nozzle.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSA00_10", "name": "Bambu PLA Basic @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Basic @base", + "from": "system", + "setting_id": "GFSA00_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "2" ], @@ -20,12 +26,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Basic @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Basic @BBL P1P.json index cc6c104cb..3f302d2c7 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Basic @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Basic @BBL P1P.json @@ -1,34 +1,34 @@ { "type": "filament", - "setting_id": "GFSA04_10", "name": "Bambu PLA Basic @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Basic @base", + "from": "system", + "setting_id": "GFSA04_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "21" ], - "slow_down_layer_time": [ - "8" - ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Marble @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Marble @BBL P1P.json index 1de552cda..fe244b347 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Marble @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Marble @BBL P1P.json @@ -1,31 +1,31 @@ { "type": "filament", - "setting_id": "GFSA07_10", "name": "Bambu PLA Marble @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Marble @base", + "from": "system", + "setting_id": "GFSA07_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], - "slow_down_layer_time": [ - "8" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Matte @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Matte @BBL P1P 0.2 nozzle.json index dcee309ee..30281a92b 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Matte @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Matte @BBL P1P 0.2 nozzle.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSA01_10", "name": "Bambu PLA Matte @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Matte @base", + "from": "system", + "setting_id": "GFSA01_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "2" ], @@ -20,12 +26,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Matte @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Matte @BBL P1P.json index 4af3f8ab5..01bbfab59 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Matte @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Matte @BBL P1P.json @@ -1,34 +1,34 @@ { "type": "filament", - "setting_id": "GFSA05_10", "name": "Bambu PLA Matte @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Matte @base", + "from": "system", + "setting_id": "GFSA05_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "22" ], - "slow_down_layer_time": [ - "8" - ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Metal @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Metal @BBL P1P 0.2 nozzle.json index e5ca0cd91..6fee30373 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Metal @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Metal @BBL P1P 0.2 nozzle.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSA02_11", "name": "Bambu PLA Metal @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Metal @base", + "from": "system", + "setting_id": "GFSA02_11", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "2" ], @@ -20,12 +26,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Metal @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Metal @BBL P1P.json index c9cf41f46..56c840f62 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Metal @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Metal @BBL P1P.json @@ -1,34 +1,34 @@ { "type": "filament", - "setting_id": "GFSA02_10", "name": "Bambu PLA Metal @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Metal @base", + "from": "system", + "setting_id": "GFSA02_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "21" ], - "slow_down_layer_time": [ - "8" - ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Silk @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Silk @BBL P1P 0.2 nozzle.json index 9287aef08..176b85982 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Silk @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Silk @BBL P1P 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSA05_11", "name": "Bambu PLA Silk @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Silk @base", + "from": "system", + "setting_id": "GFSA05_11", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Silk @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Silk @BBL P1P.json index 936782d04..840966e9b 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Silk @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Silk @BBL P1P.json @@ -1,19 +1,19 @@ { "type": "filament", - "setting_id": "GFSA05_12", "name": "Bambu PLA Silk @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Silk @base", - "slow_down_layer_time": [ - "8" - ], + "from": "system", + "setting_id": "GFSA05_12", + "instantiation": "true", "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Sparkle @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Sparkle @BBL P1P.json index 0ff5e89cb..cac47a962 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Sparkle @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Sparkle @BBL P1P.json @@ -1,31 +1,31 @@ { "type": "filament", - "setting_id": "GFSA08_10", "name": "Bambu PLA Sparkle @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Sparkle @base", + "from": "system", + "setting_id": "GFSA08_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], - "slow_down_layer_time": [ - "8" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Tough @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Tough @BBL P1P 0.2 nozzle.json index 04800c524..9df694937 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Tough @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Tough @BBL P1P 0.2 nozzle.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSA09_10", "name": "Bambu PLA Tough @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Tough @base", + "from": "system", + "setting_id": "GFSA09_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "2" ], @@ -20,12 +26,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA Tough @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA Tough @BBL P1P.json index 572c4b5c6..febb36f42 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA Tough @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA Tough @BBL P1P.json @@ -1,34 +1,34 @@ { "type": "filament", - "setting_id": "GFSA09_11", "name": "Bambu PLA Tough @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA Tough @base", + "from": "system", + "setting_id": "GFSA09_11", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "21" ], - "slow_down_layer_time": [ - "8" - ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA-CF @BBL P1P 0.8 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu PLA-CF @BBL P1P 0.8 nozzle.json index d13973d72..cb18d12ef 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA-CF @BBL P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA-CF @BBL P1P 0.8 nozzle.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSA50_11", "name": "Bambu PLA-CF @BBL P1P 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA-CF @base", + "from": "system", + "setting_id": "GFSA50_11", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "18" ], @@ -14,24 +20,18 @@ "hot_plate_temp_initial_layer": [ "65" ], - "textured_plate_temp": [ - "65" - ], - "textured_plate_temp_initial_layer": [ - "65" - ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "nozzle_temperature": [ "230" ], "nozzle_temperature_initial_layer": [ "230" ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], "compatible_printers": [ "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" diff --git a/resources/profiles/BBL/filament/P1P/Bambu PLA-CF @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu PLA-CF @BBL P1P.json index 5eca88278..c0b618072 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu PLA-CF @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu PLA-CF @BBL P1P.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSA50_10", "name": "Bambu PLA-CF @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu PLA-CF @base", + "from": "system", + "setting_id": "GFSA50_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "15" ], @@ -14,24 +20,18 @@ "hot_plate_temp_initial_layer": [ "65" ], - "textured_plate_temp": [ - "65" - ], - "textured_plate_temp_initial_layer": [ - "65" - ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "nozzle_temperature": [ "230" ], "nozzle_temperature_initial_layer": [ "230" ], + "textured_plate_temp": [ + "65" + ], + "textured_plate_temp_initial_layer": [ + "65" + ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu Support For PA PET @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu Support For PA PET @BBL P1P.json index bba2ae2a1..7b358982b 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu Support For PA PET @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu Support For PA PET @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS03_01", "name": "Bambu Support For PA/PET @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support For PA/PET @base", + "from": "system", + "setting_id": "GFSS03_01", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu Support For PLA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu Support For PLA @BBL P1P 0.2 nozzle.json index 6c5ee18e4..1311e64f4 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu Support For PLA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu Support For PLA @BBL P1P 0.2 nozzle.json @@ -1,37 +1,37 @@ { "type": "filament", - "setting_id": "GFSS02_11", "name": "Bambu Support For PLA @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support For PLA @base", + "from": "system", + "setting_id": "GFSS02_11", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "0.5" ], - "nozzle_temperature_initial_layer": [ - "240" - ], - "nozzle_temperature": [ - "240" - ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "nozzle_temperature": [ + "240" + ], + "nozzle_temperature_initial_layer": [ + "240" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu Support For PLA @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu Support For PLA @BBL P1P.json index ce56629e6..9e3cf6084 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu Support For PLA @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu Support For PLA @BBL P1P.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSS02_12", "name": "Bambu Support For PLA @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support For PLA @base", + "from": "system", + "setting_id": "GFSS02_12", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "hot_plate_temp": [ "65" ], @@ -17,12 +23,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu Support G @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu Support G @BBL P1P.json index d6e503582..9c32bfc6a 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu Support G @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu Support G @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS01_10", "name": "Bambu Support G @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support G @base", + "from": "system", + "setting_id": "GFSS01_10", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu Support W @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Bambu Support W @BBL P1P 0.2 nozzle.json index 471f83db4..a3bb24837 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu Support W @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Bambu Support W @BBL P1P 0.2 nozzle.json @@ -1,37 +1,37 @@ { "type": "filament", - "setting_id": "GFSS00_10", "name": "Bambu Support W @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support W @base", + "from": "system", + "setting_id": "GFSS00_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "0.5" ], - "nozzle_temperature_initial_layer": [ - "240" - ], - "nozzle_temperature": [ - "240" - ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "nozzle_temperature": [ + "240" + ], + "nozzle_temperature_initial_layer": [ + "240" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Bambu Support W @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu Support W @BBL P1P.json index d7fe18d99..2c721fc00 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu Support W @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu Support W @BBL P1P.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSS02_10", "name": "Bambu Support W @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu Support W @base", + "from": "system", + "setting_id": "GFSS02_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "hot_plate_temp": [ "65" ], @@ -17,12 +23,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Bambu TPU 95A @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Bambu TPU 95A @BBL P1P.json index ef68f2c39..5c980a1e6 100644 --- a/resources/profiles/BBL/filament/P1P/Bambu TPU 95A @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Bambu TPU 95A @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSU01_10", "name": "Bambu TPU 95A @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Bambu TPU 95A @base", + "from": "system", + "setting_id": "GFSU01_10", + "instantiation": "true", "filament_max_volumetric_speed": [ "3.6" ], @@ -23,7 +23,9 @@ "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", - "Bambu Lab P1P 0.8 nozzle" - ], - "version": "01.07.00.18" + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/P1P/Generic ABS @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Generic ABS @BBL P1P 0.2 nozzle.json index 3b18b92c3..5c485dad2 100644 --- a/resources/profiles/BBL/filament/P1P/Generic ABS @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Generic ABS @BBL P1P 0.2 nozzle.json @@ -1,18 +1,15 @@ { "type": "filament", - "setting_id": "GFSB99_02", "name": "Generic ABS @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic ABS @base", - "filament_max_volumetric_speed": [ - "2" - ], + "from": "system", + "setting_id": "GFSB99_02", + "instantiation": "true", "fan_max_speed": [ "20" ], - "reduce_fan_stop_start_freq": [ - "0" + "filament_max_volumetric_speed": [ + "2" ], "hot_plate_temp": [ "100" @@ -20,6 +17,9 @@ "hot_plate_temp_initial_layer": [ "100" ], + "reduce_fan_stop_start_freq": [ + "0" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic ABS @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic ABS @BBL P1P.json index 8f2b1fd8f..9da406c3d 100644 --- a/resources/profiles/BBL/filament/P1P/Generic ABS @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic ABS @BBL P1P.json @@ -1,22 +1,22 @@ { "type": "filament", - "setting_id": "GFSB99_01", "name": "Generic ABS @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic ABS @base", + "from": "system", + "setting_id": "GFSB99_01", + "instantiation": "true", "fan_max_speed": [ "20" ], - "reduce_fan_stop_start_freq": [ - "0" - ], "hot_plate_temp": [ "100" ], "hot_plate_temp_initial_layer": [ "100" ], + "reduce_fan_stop_start_freq": [ + "0" + ], "textured_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic ASA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Generic ASA @BBL P1P 0.2 nozzle.json index 0c33a8312..b2c2c547b 100644 --- a/resources/profiles/BBL/filament/P1P/Generic ASA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Generic ASA @BBL P1P 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB98_11", "name": "Generic ASA @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic ASA @base", + "from": "system", + "setting_id": "GFSB98_11", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic ASA @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic ASA @BBL P1P.json index 339dd358d..95eb52021 100644 --- a/resources/profiles/BBL/filament/P1P/Generic ASA @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic ASA @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB98_10", "name": "Generic ASA @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic ASA @base", + "from": "system", + "setting_id": "GFSB98_10", + "instantiation": "true", "hot_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic PA @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PA @BBL P1P.json index 2d212ce45..1b4a1848a 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PA @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PA @BBL P1P.json @@ -1,22 +1,22 @@ { "type": "filament", + "name": "Generic PA @BBL P1P", + "inherits": "fdm_filament_pa", + "from": "system", "filament_id": "GFN99", "setting_id": "GFSN98_10", - "name": "Generic PA @BBL P1P", - "from": "system", "instantiation": "true", - "inherits": "fdm_filament_pa", - "required_nozzle_HRC": [ - "3" - ], - "nozzle_temperature_initial_layer": [ - "280" + "filament_max_volumetric_speed": [ + "16" ], "nozzle_temperature": [ "280" ], - "filament_max_volumetric_speed": [ - "16" + "nozzle_temperature_initial_layer": [ + "280" + ], + "required_nozzle_HRC": [ + "3" ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Generic PA-CF @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PA-CF @BBL P1P.json index 07f4a404f..d5db0c94d 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PA-CF @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PA-CF @BBL P1P.json @@ -1,13 +1,13 @@ { "type": "filament", + "name": "Generic PA-CF @BBL P1P", + "inherits": "fdm_filament_pa", + "from": "system", "filament_id": "GFN98", "setting_id": "GFSN99_10", - "name": "Generic PA-CF @BBL P1P", - "from": "system", "instantiation": "true", - "inherits": "fdm_filament_pa", - "filament_type": [ - "PA-CF" + "fan_cooling_layer_time": [ + "5" ], "fan_max_speed": [ "30" @@ -15,17 +15,17 @@ "fan_min_speed": [ "10" ], - "overhang_fan_threshold": [ - "0%" + "filament_type": [ + "PA-CF" + ], + "full_fan_speed_layer": [ + "2" ], "overhang_fan_speed": [ "40" ], - "fan_cooling_layer_time": [ - "5" - ], - "full_fan_speed_layer": [ - "2" + "overhang_fan_threshold": [ + "0%" ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Generic PC @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Generic PC @BBL P1P 0.2 nozzle.json index ede9a8830..2b1cd3e5a 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PC @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Generic PC @BBL P1P 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC99_01", "name": "Generic PC @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PC @base", + "from": "system", + "setting_id": "GFSC99_01", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic PC @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PC @BBL P1P.json index fdea6384a..220d98547 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PC @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PC @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSC99_02", "name": "Generic PC @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic PC @base", + "from": "system", + "setting_id": "GFSC99_02", + "instantiation": "true", "eng_plate_temp": [ "100" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic PETG @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Generic PETG @BBL P1P 0.2 nozzle.json index 439c67d76..e4f6bed72 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PETG @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Generic PETG @BBL P1P 0.2 nozzle.json @@ -1,10 +1,13 @@ { "type": "filament", - "setting_id": "GFSG99_11", "name": "Generic PETG @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PETG @base", + "from": "system", + "setting_id": "GFSG99_11", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "1" + ], "hot_plate_temp": [ "80" ], @@ -17,9 +20,6 @@ "textured_plate_temp_initial_layer": [ "80" ], - "filament_max_volumetric_speed": [ - "1" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic PETG @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PETG @BBL P1P.json index 4103e51bc..45e9a515d 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PETG @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PETG @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG99_10", "name": "Generic PETG @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic PETG @base", + "from": "system", + "setting_id": "GFSG99_10", + "instantiation": "true", "hot_plate_temp": [ "80" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic PETG-CF @BBL A1M.json b/resources/profiles/BBL/filament/P1P/Generic PETG-CF @BBL A1M.json new file mode 100644 index 000000000..927e83952 --- /dev/null +++ b/resources/profiles/BBL/filament/P1P/Generic PETG-CF @BBL A1M.json @@ -0,0 +1,16 @@ +{ + "type": "filament", + "name": "Generic PETG-CF @BBL A1M", + "inherits": "Generic PETG-CF @BBL P1P", + "from": "system", + "setting_id": "GFSG98_00", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "8" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/P1P/Generic PETG-CF @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PETG-CF @BBL P1P.json index 894c152c2..8f0b8e5e2 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PETG-CF @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PETG-CF @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG50_10", "name": "Generic PETG-CF @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic PETG-CF @base", + "from": "system", + "setting_id": "GFSG50_10", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P 0.2 nozzle.json index b8ff4c07b..7e5aa202a 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P 0.2 nozzle.json @@ -1,16 +1,19 @@ { "type": "filament", - "setting_id": "GFSL99_11", "name": "Generic PLA @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PLA @base", + "from": "system", + "setting_id": "GFSL99_11", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "2" ], - "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif}" - ], "hot_plate_temp": [ "65" ], @@ -23,14 +26,10 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], - "version": "01.07.00.18" + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P.json index f9156161d..8f0f75748 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PLA @BBL P1P.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSL99_10", "name": "Generic PLA @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic PLA @base", + "from": "system", + "setting_id": "GFSL99_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "hot_plate_temp": [ "65" ], @@ -17,12 +23,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Generic PLA Silk @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PLA Silk @BBL P1P.json index 366bf72d6..d230b4167 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PLA Silk @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PLA Silk @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL99_12", "name": "Generic PLA Silk @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic PLA Silk @base", + "from": "system", + "setting_id": "GFSL99_12", + "instantiation": "true", "filament_max_volumetric_speed": [ "7.5" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic PLA-CF @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PLA-CF @BBL P1P.json index 4713f504b..f22741cae 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PLA-CF @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PLA-CF @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL98_10", "name": "Generic PLA-CF @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic PLA-CF @base", + "from": "system", + "setting_id": "GFSL98_10", + "instantiation": "true", "hot_plate_temp": [ "65" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic PVA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/Generic PVA @BBL P1P 0.2 nozzle.json index 79b160d76..dd094a0a5 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PVA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/Generic PVA @BBL P1P 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSS99_11", "name": "Generic PVA @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Generic PVA @base", + "from": "system", + "setting_id": "GFSS99_11", + "instantiation": "true", "filament_max_volumetric_speed": [ "0.5" ], diff --git a/resources/profiles/BBL/filament/P1P/Generic PVA @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic PVA @BBL P1P.json index 2279bdff7..127f3e099 100644 --- a/resources/profiles/BBL/filament/P1P/Generic PVA @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic PVA @BBL P1P.json @@ -1,15 +1,15 @@ { "type": "filament", - "setting_id": "GFSS99_10", "name": "Generic PVA @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "Generic PVA @base", - "textured_plate_temp": [ - "65" + "from": "system", + "setting_id": "GFSS99_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" ], - "textured_plate_temp_initial_layer": [ - "65" + "fan_min_speed": [ + "50" ], "hot_plate_temp": [ "65" @@ -17,11 +17,11 @@ "hot_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" + "textured_plate_temp": [ + "65" ], - "fan_cooling_layer_time": [ - "80" + "textured_plate_temp_initial_layer": [ + "65" ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/Generic TPU @BBL P1P.json b/resources/profiles/BBL/filament/P1P/Generic TPU @BBL P1P.json index af99bdaeb..effdb2d7f 100644 --- a/resources/profiles/BBL/filament/P1P/Generic TPU @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/Generic TPU @BBL P1P.json @@ -1,17 +1,14 @@ { "type": "filament", + "name": "Generic TPU @BBL P1P", + "inherits": "fdm_filament_tpu", + "from": "system", "filament_id": "GFU99", "setting_id": "GFSR99_10", - "name": "Generic TPU @BBL P1P", - "from": "system", "instantiation": "true", - "inherits": "fdm_filament_tpu", "filament_max_volumetric_speed": [ "3.2" ], - "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif}" - ], "hot_plate_temp": [ "45" ], @@ -29,5 +26,7 @@ "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" ], - "version": "01.07.00.18" + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif (bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif} \n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/P1P/PolyLite PLA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/PolyLite PLA @BBL P1P 0.2 nozzle.json index e869ab7c5..51579e373 100644 --- a/resources/profiles/BBL/filament/P1P/PolyLite PLA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/PolyLite PLA @BBL P1P 0.2 nozzle.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSL25_10", "name": "PolyLite PLA @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PLA @BBL X1C", + "from": "system", + "setting_id": "GFSL25_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "1" ], @@ -20,12 +26,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/PolyLite PLA @BBL P1P.json b/resources/profiles/BBL/filament/P1P/PolyLite PLA @BBL P1P.json index 6d8f8048d..fd454ccd7 100644 --- a/resources/profiles/BBL/filament/P1P/PolyLite PLA @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/PolyLite PLA @BBL P1P.json @@ -1,34 +1,34 @@ { "type": "filament", - "setting_id": "GFSL23_10", "name": "PolyLite PLA @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PLA @base", + "from": "system", + "setting_id": "GFSL23_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "15" ], - "slow_down_layer_time": [ - "8" - ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P 0.2 nozzle.json index caf5221da..3d1deed7d 100644 --- a/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P 0.2 nozzle.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSL24_10", "name": "PolyTerra PLA @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyTerra PLA @BBL X1C", + "from": "system", + "setting_id": "GFSL24_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "1" ], @@ -20,12 +26,6 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" ], diff --git a/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P.json b/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P.json index 4d3f0476a..798048d97 100644 --- a/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/PolyTerra PLA @BBL P1P.json @@ -1,34 +1,34 @@ { "type": "filament", - "setting_id": "GFSL22_10", "name": "PolyTerra PLA @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "PolyTerra PLA @base", + "from": "system", + "setting_id": "GFSL22_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "22" ], - "slow_down_layer_time": [ - "8" - ], "hot_plate_temp": [ "65" ], "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "8" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", diff --git a/resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P 0.2 nozzle.json index f96da4892..154a347fd 100644 --- a/resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P 0.2 nozzle.json @@ -1,10 +1,16 @@ { "type": "filament", - "setting_id": "GFSL03_10", "name": "eSUN PLA+ @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "eSUN PLA+ @base", + "from": "system", + "setting_id": "GFSL03_10", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" + ], "filament_max_volumetric_speed": [ "1" ], @@ -20,14 +26,7 @@ "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P.json b/resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P.json index 26edb0339..a2523d3f5 100644 --- a/resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P.json +++ b/resources/profiles/BBL/filament/P1P/eSUN PLA+ @BBL P1P.json @@ -1,12 +1,15 @@ { "type": "filament", - "setting_id": "GFSL03_11", "name": "eSUN PLA+ @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "eSUN PLA+ @base", - "slow_down_layer_time": [ - "10" + "from": "system", + "setting_id": "GFSL03_11", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_min_speed": [ + "50" ], "hot_plate_temp": [ "65" @@ -14,22 +17,18 @@ "hot_plate_temp_initial_layer": [ "65" ], + "slow_down_layer_time": [ + "10" + ], "textured_plate_temp": [ "65" ], "textured_plate_temp_initial_layer": [ "65" ], - "fan_min_speed": [ - "50" - ], - "fan_cooling_layer_time": [ - "80" - ], "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ABS @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite ABS @BBL P1P 0.2 nozzle.json index 537a06c73..82d325cab 100644 --- a/resources/profiles/BBL/filament/PolyLite ABS @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/PolyLite ABS @BBL P1P 0.2 nozzle.json @@ -1,15 +1,14 @@ { "type": "filament", - "setting_id": "GFSB60_05", "name": "PolyLite ABS @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyLite ABS @BBL P1P", + "from": "system", + "setting_id": "GFSB60_05", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ABS @BBL P1P.json b/resources/profiles/BBL/filament/PolyLite ABS @BBL P1P.json index 56212c576..264eaa67c 100644 --- a/resources/profiles/BBL/filament/PolyLite ABS @BBL P1P.json +++ b/resources/profiles/BBL/filament/PolyLite ABS @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB60_04", "name": "PolyLite ABS @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "PolyLite ABS @base", + "from": "system", + "setting_id": "GFSB60_04", + "instantiation": "true", "fan_max_speed": [ "20" ], @@ -27,6 +27,5 @@ "Bambu Lab P1P 0.8 nozzle", "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ABS @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite ABS @BBL X1C 0.2 nozzle.json index d23adde4b..fe96accbf 100644 --- a/resources/profiles/BBL/filament/PolyLite ABS @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/PolyLite ABS @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB60_02", "name": "PolyLite ABS @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyLite ABS @BBL X1C", + "from": "system", + "setting_id": "GFSB60_02", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ABS @BBL X1C.json b/resources/profiles/BBL/filament/PolyLite ABS @BBL X1C.json index dfac5a9b6..c3738bc33 100644 --- a/resources/profiles/BBL/filament/PolyLite ABS @BBL X1C.json +++ b/resources/profiles/BBL/filament/PolyLite ABS @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB60_00", "name": "PolyLite ABS @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "PolyLite ABS @base", + "from": "system", + "setting_id": "GFSB60_00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", @@ -15,6 +15,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ABS @base.json b/resources/profiles/BBL/filament/PolyLite ABS @base.json index fcbc279de..e722c94f0 100644 --- a/resources/profiles/BBL/filament/PolyLite ABS @base.json +++ b/resources/profiles/BBL/filament/PolyLite ABS @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFB60", "name": "PolyLite ABS @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_abs", + "from": "system", + "filament_id": "GFB60", + "instantiation": "false", "filament_cost": [ "26.9" ], diff --git a/resources/profiles/BBL/filament/PolyLite ASA @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite ASA @BBL P1P 0.2 nozzle.json index 714a02054..a40ce5372 100644 --- a/resources/profiles/BBL/filament/PolyLite ASA @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/PolyLite ASA @BBL P1P 0.2 nozzle.json @@ -1,15 +1,14 @@ { "type": "filament", - "setting_id": "GFSB61_05", "name": "PolyLite ASA @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyLite ASA @BBL P1P", + "from": "system", + "setting_id": "GFSB61_05", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ASA @BBL P1P.json b/resources/profiles/BBL/filament/PolyLite ASA @BBL P1P.json index e551f7b60..2b00174b2 100644 --- a/resources/profiles/BBL/filament/PolyLite ASA @BBL P1P.json +++ b/resources/profiles/BBL/filament/PolyLite ASA @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB61_04", "name": "PolyLite ASA @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "PolyLite ASA @base", + "from": "system", + "setting_id": "GFSB61_04", + "instantiation": "true", "hot_plate_temp": [ "100" ], @@ -21,6 +21,5 @@ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ASA @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite ASA @BBL X1C 0.2 nozzle.json index 10ef3d784..16bc0ad8e 100644 --- a/resources/profiles/BBL/filament/PolyLite ASA @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/PolyLite ASA @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB61_01", "name": "PolyLite ASA @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyLite ASA @BBL X1C", + "from": "system", + "setting_id": "GFSB61_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "2" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ASA @BBL X1C.json b/resources/profiles/BBL/filament/PolyLite ASA @BBL X1C.json index 84a6d9a99..3380230fd 100644 --- a/resources/profiles/BBL/filament/PolyLite ASA @BBL X1C.json +++ b/resources/profiles/BBL/filament/PolyLite ASA @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSB61_00", "name": "PolyLite ASA @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "PolyLite ASA @base", + "from": "system", + "setting_id": "GFSB61_00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", @@ -15,6 +15,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite ASA @base.json b/resources/profiles/BBL/filament/PolyLite ASA @base.json index a01b2a5f2..169e38c12 100644 --- a/resources/profiles/BBL/filament/PolyLite ASA @base.json +++ b/resources/profiles/BBL/filament/PolyLite ASA @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFB61", "name": "PolyLite ASA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_asa", + "from": "system", + "filament_id": "GFB61", + "instantiation": "false", "filament_cost": [ "23.6" ], diff --git a/resources/profiles/BBL/filament/PolyLite PETG @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite PETG @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..a7cc88d94 --- /dev/null +++ b/resources/profiles/BBL/filament/PolyLite PETG @BBL A1M 0.2 nozzle.json @@ -0,0 +1,14 @@ +{ + "type": "filament", + "name": "PolyLite PETG @BBL A1M 0.2 nozzle", + "inherits": "PolyLite PETG @BBL A1M", + "from": "system", + "setting_id": "GFSG60_05", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "1" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PETG @BBL A1M.json b/resources/profiles/BBL/filament/PolyLite PETG @BBL A1M.json new file mode 100644 index 000000000..81ade454b --- /dev/null +++ b/resources/profiles/BBL/filament/PolyLite PETG @BBL A1M.json @@ -0,0 +1,19 @@ +{ + "type": "filament", + "name": "PolyLite PETG @BBL A1M", + "inherits": "PolyLite PETG @base", + "from": "system", + "setting_id": "GFSG60_04", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "8" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PETG @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite PETG @BBL P1P 0.2 nozzle.json index 3a25bac8b..a8a418a64 100644 --- a/resources/profiles/BBL/filament/PolyLite PETG @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/PolyLite PETG @BBL P1P 0.2 nozzle.json @@ -1,15 +1,14 @@ { "type": "filament", - "setting_id": "GFSG60_03", "name": "PolyLite PETG @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PETG @BBL P1P", + "from": "system", + "setting_id": "GFSG60_03", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PETG @BBL P1P.json b/resources/profiles/BBL/filament/PolyLite PETG @BBL P1P.json index c0b0bc7a4..9d3d62773 100644 --- a/resources/profiles/BBL/filament/PolyLite PETG @BBL P1P.json +++ b/resources/profiles/BBL/filament/PolyLite PETG @BBL P1P.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG60_02", "name": "PolyLite PETG @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PETG @base", + "from": "system", + "setting_id": "GFSG60_02", + "instantiation": "true", "filament_max_volumetric_speed": [ "11" ], @@ -27,6 +27,5 @@ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1P 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PETG @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite PETG @BBL X1C 0.2 nozzle.json index 534b4484b..9a58b91bf 100644 --- a/resources/profiles/BBL/filament/PolyLite PETG @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/PolyLite PETG @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG60_01", "name": "PolyLite PETG @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PETG @BBL X1C", + "from": "system", + "setting_id": "GFSG60_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PETG @BBL X1C.json b/resources/profiles/BBL/filament/PolyLite PETG @BBL X1C.json index 54efcbeaa..ea9688b83 100644 --- a/resources/profiles/BBL/filament/PolyLite PETG @BBL X1C.json +++ b/resources/profiles/BBL/filament/PolyLite PETG @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSG60_00", "name": "PolyLite PETG @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PETG @base", + "from": "system", + "setting_id": "GFSG60_00", + "instantiation": "true", "filament_max_volumetric_speed": [ "11" ], @@ -21,6 +21,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PETG @base.json b/resources/profiles/BBL/filament/PolyLite PETG @base.json index 22964406d..60c9451a5 100644 --- a/resources/profiles/BBL/filament/PolyLite PETG @base.json +++ b/resources/profiles/BBL/filament/PolyLite PETG @base.json @@ -1,10 +1,10 @@ { "type": "filament", - "filament_id": "GFG60", "name": "PolyLite PETG @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pet", + "from": "system", + "filament_id": "GFG60", + "instantiation": "false", "cool_plate_temp": [ "0" ], diff --git a/resources/profiles/BBL/filament/PolyLite PLA @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite PLA @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..ff991970c --- /dev/null +++ b/resources/profiles/BBL/filament/PolyLite PLA @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "PolyLite PLA @BBL A1M 0.2 nozzle", + "inherits": "PolyLite PLA @base", + "from": "system", + "setting_id": "GFSL00_01", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "1" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PLA @BBL A1M.json b/resources/profiles/BBL/filament/PolyLite PLA @BBL A1M.json new file mode 100644 index 000000000..a07bb0110 --- /dev/null +++ b/resources/profiles/BBL/filament/PolyLite PLA @BBL A1M.json @@ -0,0 +1,40 @@ +{ + "type": "filament", + "name": "PolyLite PLA @BBL A1M", + "inherits": "PolyLite PLA @base", + "from": "system", + "setting_id": "GFSL00_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "15" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json index fccd7d650..4ed582192 100644 --- a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json +++ b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL23", "name": "PolyLite PLA @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PLA @base", + "from": "system", + "setting_id": "GFSL23", + "instantiation": "true", "filament_max_volumetric_speed": [ "15" ], @@ -15,6 +15,5 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C 0.2 nozzle.json index fab179b66..2c35f77ed 100644 --- a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL25", "name": "PolyLite PLA @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PLA @BBL X1C", + "from": "system", + "setting_id": "GFSL25", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], diff --git a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C.json b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C.json index 71f2d583a..5f6ec5bea 100644 --- a/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/PolyLite PLA @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL19", "name": "PolyLite PLA @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "PolyLite PLA @base", + "from": "system", + "setting_id": "GFSL19", + "instantiation": "true", "filament_max_volumetric_speed": [ "15" ], diff --git a/resources/profiles/BBL/filament/PolyLite PLA @base.json b/resources/profiles/BBL/filament/PolyLite PLA @base.json index f8914467e..1e7f4d16b 100644 --- a/resources/profiles/BBL/filament/PolyLite PLA @base.json +++ b/resources/profiles/BBL/filament/PolyLite PLA @base.json @@ -1,17 +1,17 @@ { "type": "filament", - "filament_id": "GFL00", "name": "PolyLite PLA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Polymaker" - ], + "from": "system", + "filament_id": "GFL00", + "instantiation": "false", "filament_cost": [ "25.4" ], "filament_flow_ratio": [ "0.95" + ], + "filament_vendor": [ + "Polymaker" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyTerra PLA @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyTerra PLA @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..73d3ce1a8 --- /dev/null +++ b/resources/profiles/BBL/filament/PolyTerra PLA @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "PolyTerra PLA @BBL A1M 0.2 nozzle", + "inherits": "PolyTerra PLA @base", + "from": "system", + "setting_id": "GFSL01_01", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "1" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyTerra PLA @BBL A1M.json b/resources/profiles/BBL/filament/PolyTerra PLA @BBL A1M.json new file mode 100644 index 000000000..288e5e938 --- /dev/null +++ b/resources/profiles/BBL/filament/PolyTerra PLA @BBL A1M.json @@ -0,0 +1,40 @@ +{ + "type": "filament", + "name": "PolyTerra PLA @BBL A1M", + "inherits": "PolyTerra PLA @base", + "from": "system", + "setting_id": "GFSL01_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "22" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json index 5e63867c4..d3fd2251c 100644 --- a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json +++ b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL22", "name": "PolyTerra PLA @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "PolyTerra PLA @base", + "from": "system", + "setting_id": "GFSL22", + "instantiation": "true", "filament_max_volumetric_speed": [ "22" ], @@ -15,6 +15,5 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C 0.2 nozzle.json index 9b76837ae..595b9fa2d 100644 --- a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL24", "name": "PolyTerra PLA @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "PolyTerra PLA @BBL X1C", + "from": "system", + "setting_id": "GFSL24", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], diff --git a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C.json b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C.json index 529dd61a7..9f5814619 100644 --- a/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C.json +++ b/resources/profiles/BBL/filament/PolyTerra PLA @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL18", "name": "PolyTerra PLA @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "PolyTerra PLA @base", + "from": "system", + "setting_id": "GFSL18", + "instantiation": "true", "filament_max_volumetric_speed": [ "22" ], diff --git a/resources/profiles/BBL/filament/PolyTerra PLA @base.json b/resources/profiles/BBL/filament/PolyTerra PLA @base.json index 16a29aa51..2deb2d914 100644 --- a/resources/profiles/BBL/filament/PolyTerra PLA @base.json +++ b/resources/profiles/BBL/filament/PolyTerra PLA @base.json @@ -1,13 +1,10 @@ { "type": "filament", - "filament_id": "GFL01", "name": "PolyTerra PLA @base", - "from": "system", - "instantiation": "false", "inherits": "fdm_filament_pla", - "filament_vendor": [ - "Polymaker" - ], + "from": "system", + "filament_id": "GFL01", + "instantiation": "false", "filament_cost": [ "25.4" ], @@ -16,5 +13,8 @@ ], "filament_flow_ratio": [ "0.98" + ], + "filament_vendor": [ + "Polymaker" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/eSUN PLA+ @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/filament/eSUN PLA+ @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..96573934d --- /dev/null +++ b/resources/profiles/BBL/filament/eSUN PLA+ @BBL A1M 0.2 nozzle.json @@ -0,0 +1,38 @@ +{ + "type": "filament", + "name": "eSUN PLA+ @BBL A1M 0.2 nozzle", + "inherits": "eSUN PLA+ @base", + "from": "system", + "setting_id": "GFSL03_04", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "filament_max_volumetric_speed": [ + "1" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/eSUN PLA+ @BBL A1M.json b/resources/profiles/BBL/filament/eSUN PLA+ @BBL A1M.json new file mode 100644 index 000000000..92a72de8f --- /dev/null +++ b/resources/profiles/BBL/filament/eSUN PLA+ @BBL A1M.json @@ -0,0 +1,37 @@ +{ + "type": "filament", + "name": "eSUN PLA+ @BBL A1M", + "inherits": "eSUN PLA+ @base", + "from": "system", + "setting_id": "GFSL03_03", + "instantiation": "true", + "fan_cooling_layer_time": [ + "80" + ], + "fan_max_speed": [ + "80" + ], + "fan_min_speed": [ + "60" + ], + "hot_plate_temp": [ + "60" + ], + "hot_plate_temp_initial_layer": [ + "60" + ], + "slow_down_layer_time": [ + "8" + ], + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle", + "Bambu Lab A1 mini 0.6 nozzle", + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1.json b/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1.json index d29a748ac..fca65e947 100644 --- a/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1.json +++ b/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL03_02", "name": "eSUN PLA+ @BBL X1", - "from": "system", - "instantiation": "true", "inherits": "eSUN PLA+ @base", + "from": "system", + "setting_id": "GFSL03_02", + "instantiation": "true", "slow_down_layer_time": [ "10" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C 0.2 nozzle.json index 498024826..25394b7ff 100644 --- a/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL03_01", "name": "eSUN PLA+ @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "eSUN PLA+ @base", + "from": "system", + "setting_id": "GFSL03_01", + "instantiation": "true", "filament_max_volumetric_speed": [ "1" ], @@ -12,6 +12,5 @@ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C.json b/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C.json index 0b7291e5a..686d1dd3c 100644 --- a/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C.json +++ b/resources/profiles/BBL/filament/eSUN PLA+ @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "filament", - "setting_id": "GFSL03_00", "name": "eSUN PLA+ @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "eSUN PLA+ @base", + "from": "system", + "setting_id": "GFSL03_00", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle", @@ -12,6 +12,5 @@ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab P1S 0.6 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/eSUN PLA+ @base.json b/resources/profiles/BBL/filament/eSUN PLA+ @base.json index 160bd7fb4..6219d2456 100644 --- a/resources/profiles/BBL/filament/eSUN PLA+ @base.json +++ b/resources/profiles/BBL/filament/eSUN PLA+ @base.json @@ -1,29 +1,29 @@ { - "type": "filament", - "filament_id": "GFL03", - "name": "eSUN PLA+ @base", - "from": "system", - "instantiation": "false", - "inherits": "fdm_filament_pla", - "filament_vendor": [ - "eSUN" - ], - "filament_cost": [ - "22.99" - ], - "filament_density": [ - "1.25" - ], - "filament_flow_ratio": [ - "0.98" - ], - "slow_down_layer_time": [ - "6" - ], - "filament_max_volumetric_speed": [ - "16" - ], - "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}" - ] + "type": "filament", + "name": "eSUN PLA+ @base", + "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFL03", + "instantiation": "false", + "filament_cost": [ + "22.99" + ], + "filament_density": [ + "1.25" + ], + "filament_flow_ratio": [ + "0.98" + ], + "filament_max_volumetric_speed": [ + "16" + ], + "filament_vendor": [ + "eSUN" + ], + "slow_down_layer_time": [ + "6" + ], + "filament_start_gcode": [ + "; filament start gcode\n{if (bed_temperature[current_extruder] >55)||(bed_temperature_initial_layer[current_extruder] >55)}M106 P3 S200\n{elsif(bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S150\n{elsif(bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S50\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_abs.json b/resources/profiles/BBL/filament/fdm_filament_abs.json index 16497a718..461dd5e61 100644 --- a/resources/profiles/BBL/filament/fdm_filament_abs.json +++ b/resources/profiles/BBL/filament/fdm_filament_abs.json @@ -1,88 +1,82 @@ { "type": "filament", "name": "fdm_filament_abs", + "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "inherits": "fdm_filament_common", - "cool_plate_temp" : [ - "0" - ], - "eng_plate_temp" : [ - "90" - ], - "hot_plate_temp" : [ - "90" - ], - "textured_plate_temp" : [ - "90" - ], - "cool_plate_temp_initial_layer" : [ - "0" - ], - "eng_plate_temp_initial_layer" : [ - "90" - ], - "hot_plate_temp_initial_layer" : [ - "90" - ], - "textured_plate_temp_initial_layer" : [ - "90" - ], - "slow_down_for_layer_cooling": [ + "activate_air_filtration": [ "1" ], - "close_fan_the_first_x_layers": [ - "3" + "cool_plate_temp": [ + "0" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp": [ + "90" + ], + "eng_plate_temp_initial_layer": [ + "90" ], "fan_cooling_layer_time": [ "30" ], - "filament_max_volumetric_speed": [ - "28.6" - ], - "filament_type": [ - "ABS" - ], - "filament_density": [ - "1.04" - ], - "filament_cost": [ - "20" - ], - "nozzle_temperature_initial_layer": [ - "260" - ], - "reduce_fan_stop_start_freq": [ - "1" - ], "fan_max_speed": [ "80" ], "fan_min_speed": [ "10" ], - "overhang_fan_threshold": [ - "25%" + "filament_cost": [ + "20" ], - "overhang_fan_speed": [ - "80" + "filament_density": [ + "1.04" + ], + "filament_max_volumetric_speed": [ + "28.6" + ], + "filament_type": [ + "ABS" + ], + "hot_plate_temp": [ + "90" + ], + "hot_plate_temp_initial_layer": [ + "90" ], "nozzle_temperature": [ "270" ], - "temperature_vitrification": [ - "100" - ], - "nozzle_temperature_range_low": [ - "240" + "nozzle_temperature_initial_layer": [ + "260" ], "nozzle_temperature_range_high": [ "280" ], - "slow_down_min_speed": [ - "20" + "nozzle_temperature_range_low": [ + "240" + ], + "overhang_fan_speed": [ + "80" + ], + "overhang_fan_threshold": [ + "25%" + ], + "reduce_fan_stop_start_freq": [ + "1" ], "slow_down_layer_time": [ "3" + ], + "slow_down_min_speed": [ + "20" + ], + "textured_plate_temp": [ + "90" + ], + "textured_plate_temp_initial_layer": [ + "90" ] -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_asa.json b/resources/profiles/BBL/filament/fdm_filament_asa.json index 1828f9688..ac7a9294c 100644 --- a/resources/profiles/BBL/filament/fdm_filament_asa.json +++ b/resources/profiles/BBL/filament/fdm_filament_asa.json @@ -1,79 +1,82 @@ { "type": "filament", "name": "fdm_filament_asa", + "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "inherits": "fdm_filament_common", + "activate_air_filtration": [ + "1" + ], "cool_plate_temp": [ "0" ], + "cool_plate_temp_initial_layer": [ + "0" + ], "eng_plate_temp": [ "90" ], - "hot_plate_temp": [ - "90" - ], - "textured_plate_temp": [ - "90" - ], - "cool_plate_temp_initial_layer": [ - "0" - ], "eng_plate_temp_initial_layer": [ "90" ], - "hot_plate_temp_initial_layer": [ - "90" - ], - "textured_plate_temp_initial_layer": [ - "90" - ], "fan_cooling_layer_time": [ "35" ], - "filament_max_volumetric_speed": [ - "28.6" - ], - "filament_type": [ - "ASA" - ], - "filament_density": [ - "1.04" - ], - "filament_cost": [ - "20" - ], - "nozzle_temperature_initial_layer": [ - "260" - ], - "reduce_fan_stop_start_freq": [ - "1" - ], "fan_max_speed": [ "80" ], "fan_min_speed": [ "10" ], - "overhang_fan_threshold": [ - "25%" + "filament_cost": [ + "20" ], - "overhang_fan_speed": [ - "80" + "filament_density": [ + "1.04" + ], + "filament_max_volumetric_speed": [ + "28.6" + ], + "filament_type": [ + "ASA" + ], + "hot_plate_temp": [ + "90" + ], + "hot_plate_temp_initial_layer": [ + "90" ], "nozzle_temperature": [ "260" ], - "nozzle_temperature_range_low": [ - "240" + "nozzle_temperature_initial_layer": [ + "260" ], "nozzle_temperature_range_high": [ "280" ], - "slow_down_min_speed": [ - "20" + "nozzle_temperature_range_low": [ + "240" + ], + "overhang_fan_speed": [ + "80" + ], + "overhang_fan_threshold": [ + "25%" + ], + "reduce_fan_stop_start_freq": [ + "1" ], "slow_down_layer_time": [ "3" + ], + "slow_down_min_speed": [ + "20" + ], + "textured_plate_temp": [ + "90" + ], + "textured_plate_temp_initial_layer": [ + "90" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_common.json b/resources/profiles/BBL/filament/fdm_filament_common.json index 8ea752f4d..6f1291c6e 100644 --- a/resources/profiles/BBL/filament/fdm_filament_common.json +++ b/resources/profiles/BBL/filament/fdm_filament_common.json @@ -3,60 +3,42 @@ "name": "fdm_filament_common", "from": "system", "instantiation": "false", - "filament_is_support": [ + "activate_air_filtration": [ "0" ], - "required_nozzle_HRC": [ + "chamber_temperatures": [ + "0" + ], + "close_fan_the_first_x_layers": [ "3" ], + "complete_print_exhaust_fan_speed": [ + "70" + ], "cool_plate_temp": [ "60" ], - "eng_plate_temp": [ - "60" - ], - "hot_plate_temp": [ - "60" - ], - "textured_plate_temp": [ - "60" - ], "cool_plate_temp_initial_layer": [ "60" ], + "during_print_exhaust_fan_speed": [ + "70" + ], + "eng_plate_temp": [ + "60" + ], "eng_plate_temp_initial_layer": [ "60" ], - "hot_plate_temp_initial_layer": [ - "60" - ], - "textured_plate_temp_initial_layer": [ - "60" - ], - "overhang_fan_threshold": [ - "95%" - ], - "overhang_fan_speed": [ - "100" - ], - "slow_down_for_layer_cooling": [ - "1" - ], - "close_fan_the_first_x_layers": [ - "3" - ], - "filament_end_gcode": [ - "; filament end gcode \nM106 P3 S0\n" - ], - "filament_flow_ratio": [ - "1" - ], - "reduce_fan_stop_start_freq": [ - "0" - ], "fan_cooling_layer_time": [ "60" ], + "fan_max_speed": [ + "100" + ], + "fan_min_speed": [ + "35" + ], "filament_cost": [ "0" ], @@ -69,16 +51,22 @@ "filament_diameter": [ "1.75" ], + "filament_flow_ratio": [ + "1" + ], + "filament_is_support": [ + "0" + ], "filament_max_volumetric_speed": [ "0" ], "filament_minimal_purge_on_wipe_tower": [ "15" ], - "filament_retraction_minimum_travel": [ + "filament_retract_before_wipe": [ "nil" ], - "filament_retract_before_wipe": [ + "filament_retract_restart_extra": [ "nil" ], "filament_retract_when_changing_layer": [ @@ -87,13 +75,7 @@ "filament_retraction_length": [ "nil" ], - "filament_z_hop": [ - "nil" - ], - "filament_z_hop_types": [ - "nil" - ], - "filament_retract_restart_extra": [ + "filament_retraction_minimum_travel": [ "nil" ], "filament_retraction_speed": [ @@ -117,32 +99,62 @@ "filament_wipe_distance": [ "nil" ], - "nozzle_temperature_initial_layer": [ - "200" + "filament_z_hop": [ + "nil" + ], + "filament_z_hop_types": [ + "nil" ], "full_fan_speed_layer": [ "0" ], - "fan_max_speed": [ - "100" + "hot_plate_temp": [ + "60" ], - "fan_min_speed": [ - "35" - ], - "slow_down_min_speed": [ - "10" - ], - "slow_down_layer_time": [ - "8" - ], - "filament_start_gcode": [ - "; Filament gcode\n" + "hot_plate_temp_initial_layer": [ + "60" ], "nozzle_temperature": [ "200" ], + "nozzle_temperature_initial_layer": [ + "200" + ], + "overhang_fan_speed": [ + "100" + ], + "overhang_fan_threshold": [ + "95%" + ], + "reduce_fan_stop_start_freq": [ + "0" + ], + "required_nozzle_HRC": [ + "3" + ], + "slow_down_for_layer_cooling": [ + "1" + ], + "slow_down_layer_time": [ + "8" + ], + "slow_down_min_speed": [ + "10" + ], "temperature_vitrification": [ "100" ], - "compatible_printers":[] + "textured_plate_temp": [ + "60" + ], + "textured_plate_temp_initial_layer": [ + "60" + ], + "compatible_printers": [], + "filament_start_gcode": [ + "; Filament gcode\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" + ], + "filament_end_gcode": [ + "; filament end gcode \nM106 P3 S0\n" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_hips.json b/resources/profiles/BBL/filament/fdm_filament_hips.json index be50ef8fc..4d1b09d37 100644 --- a/resources/profiles/BBL/filament/fdm_filament_hips.json +++ b/resources/profiles/BBL/filament/fdm_filament_hips.json @@ -1,85 +1,79 @@ { - "type": "filament", - "name": "fdm_filament_hips", - "from": "system", - "instantiation": "false", - "inherits": "fdm_filament_common", - "cool_plate_temp": [ - "0" - ], - "eng_plate_temp": [ - "90" - ], - "hot_plate_temp": [ - "90" - ], - "textured_plate_temp": [ - "90" - ], - "cool_plate_temp_initial_layer": [ - "0" - ], - "eng_plate_temp_initial_layer": [ - "90" - ], - "hot_plate_temp_initial_layer": [ - "90" - ], - "textured_plate_temp_initial_layer": [ - "90" - ], - "fan_cooling_layer_time": [ - "10" - ], - "filament_max_volumetric_speed": [ - "8" - ], - "filament_type": [ - "HIPS" - ], - "filament_density": [ - "1.06" - ], - "filament_cost": [ - "22.99" - ], - "nozzle_temperature_initial_layer": [ - "240" - ], - "fan_max_speed": [ - "60" - ], - "fan_min_speed": [ - "0" - ], - "overhang_fan_threshold": [ - "25%" - ], - "overhang_fan_speed": [ - "80" - ], - "nozzle_temperature": [ - "240" - ], - "nozzle_temperature_range_low": [ - "220" - ], - "nozzle_temperature_range_high": [ - "270" - ], - "slow_down_min_speed": [ - "20" - ], - "slow_down_layer_time": [ - "6" - ], - "temperature_vitrification": [ - "100" - ], - "required_nozzle_HRC": [ - "3" - ], - "additional_cooling_fan_speed":[ - "0" - ] + "type": "filament", + "name": "fdm_filament_hips", + "inherits": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "cool_plate_temp": [ + "0" + ], + "eng_plate_temp": [ + "90" + ], + "hot_plate_temp": [ + "90" + ], + "textured_plate_temp": [ + "90" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp_initial_layer": [ + "90" + ], + "hot_plate_temp_initial_layer": [ + "90" + ], + "textured_plate_temp_initial_layer": [ + "90" + ], + "fan_cooling_layer_time": [ + "10" + ], + "filament_max_volumetric_speed": [ + "8" + ], + "filament_type": [ + "HIPS" + ], + "filament_density": [ + "1.06" + ], + "filament_cost": [ + "22.99" + ], + "nozzle_temperature_initial_layer": [ + "240" + ], + "fan_max_speed": [ + "60" + ], + "fan_min_speed": [ + "0" + ], + "overhang_fan_threshold": [ + "25%" + ], + "overhang_fan_speed": [ + "80" + ], + "nozzle_temperature": [ + "240" + ], + "nozzle_temperature_range_low": [ + "220" + ], + "nozzle_temperature_range_high": [ + "270" + ], + "slow_down_min_speed": [ + "20" + ], + "slow_down_layer_time": [ + "6" + ], + "additional_cooling_fan_speed": [ + "0" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pa.json b/resources/profiles/BBL/filament/fdm_filament_pa.json index 89d268af2..1cd78ec77 100644 --- a/resources/profiles/BBL/filament/fdm_filament_pa.json +++ b/resources/profiles/BBL/filament/fdm_filament_pa.json @@ -1,79 +1,82 @@ { "type": "filament", "name": "fdm_filament_pa", + "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "inherits": "fdm_filament_common", - "required_nozzle_HRC": [ - "40" + "activate_air_filtration": [ + "1" ], "cool_plate_temp": [ "0" ], + "cool_plate_temp_initial_layer": [ + "0" + ], "eng_plate_temp": [ "100" ], - "hot_plate_temp": [ - "100" - ], - "textured_plate_temp": [ - "100" - ], - "cool_plate_temp_initial_layer": [ - "0" - ], "eng_plate_temp_initial_layer": [ "100" ], - "hot_plate_temp_initial_layer": [ - "100" - ], - "textured_plate_temp_initial_layer": [ - "100" - ], "fan_cooling_layer_time": [ "4" ], - "filament_max_volumetric_speed": [ - "8" - ], - "filament_type": [ - "PA" - ], - "filament_density": [ - "1.04" - ], - "filament_cost": [ - "20" - ], - "nozzle_temperature_initial_layer": [ - "290" - ], "fan_max_speed": [ "60" ], "fan_min_speed": [ "0" ], - "overhang_fan_speed": [ - "30" + "filament_cost": [ + "20" + ], + "filament_density": [ + "1.04" + ], + "filament_max_volumetric_speed": [ + "8" + ], + "filament_type": [ + "PA" + ], + "hot_plate_temp": [ + "100" + ], + "hot_plate_temp_initial_layer": [ + "100" ], "nozzle_temperature": [ "290" ], - "temperature_vitrification": [ - "108" - ], - "nozzle_temperature_range_low": [ - "260" + "nozzle_temperature_initial_layer": [ + "290" ], "nozzle_temperature_range_high": [ "300" ], - "slow_down_min_speed": [ - "20" + "nozzle_temperature_range_low": [ + "260" + ], + "overhang_fan_speed": [ + "30" + ], + "required_nozzle_HRC": [ + "40" ], "slow_down_layer_time": [ "2" + ], + "slow_down_min_speed": [ + "20" + ], + "temperature_vitrification": [ + "108" + ], + "textured_plate_temp": [ + "100" + ], + "textured_plate_temp_initial_layer": [ + "100" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pc.json b/resources/profiles/BBL/filament/fdm_filament_pc.json index 477812e6d..572911429 100644 --- a/resources/profiles/BBL/filament/fdm_filament_pc.json +++ b/resources/profiles/BBL/filament/fdm_filament_pc.json @@ -1,9 +1,9 @@ { "type": "filament", "name": "fdm_filament_pc", + "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "inherits": "fdm_filament_common", "cool_plate_temp": [ "0" ], diff --git a/resources/profiles/BBL/filament/fdm_filament_pet.json b/resources/profiles/BBL/filament/fdm_filament_pet.json index e71333f63..4a5f6085c 100644 --- a/resources/profiles/BBL/filament/fdm_filament_pet.json +++ b/resources/profiles/BBL/filament/fdm_filament_pet.json @@ -1,64 +1,64 @@ { "type": "filament", "name": "fdm_filament_pet", + "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "inherits": "fdm_filament_common", "eng_plate_temp": [ "0" ], - "hot_plate_temp": [ - "80" - ], - "textured_plate_temp": [ - "80" - ], "eng_plate_temp_initial_layer": [ "0" ], - "hot_plate_temp_initial_layer": [ - "80" - ], - "textured_plate_temp_initial_layer": [ - "80" - ], "fan_cooling_layer_time": [ "20" ], + "fan_min_speed": [ + "20" + ], + "filament_cost": [ + "30" + ], + "filament_density": [ + "1.27" + ], "filament_max_volumetric_speed": [ "25" ], "filament_type": [ "PETG" ], - "filament_density": [ - "1.27" + "hot_plate_temp": [ + "80" ], - "filament_cost": [ - "30" - ], - "nozzle_temperature_initial_layer": [ - "255" - ], - "reduce_fan_stop_start_freq": [ - "1" - ], - "fan_min_speed": [ - "20" + "hot_plate_temp_initial_layer": [ + "80" ], "nozzle_temperature": [ "255" ], - "temperature_vitrification": [ - "70" - ], - "nozzle_temperature_range_low": [ - "220" + "nozzle_temperature_initial_layer": [ + "255" ], "nozzle_temperature_range_high": [ "260" ], + "nozzle_temperature_range_low": [ + "220" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "temperature_vitrification": [ + "70" + ], + "textured_plate_temp": [ + "80" + ], + "textured_plate_temp_initial_layer": [ + "80" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S180\n{elsif (bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S255\n{endif};Prevent PLA from jamming" + "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S180\n{elsif (bed_temperature[current_extruder] >50)||(bed_temperature_initial_layer[current_extruder] >50)}M106 P3 S255\n{endif};Prevent PLA from jamming\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pla.json b/resources/profiles/BBL/filament/fdm_filament_pla.json index b90eebee8..822882710 100644 --- a/resources/profiles/BBL/filament/fdm_filament_pla.json +++ b/resources/profiles/BBL/filament/fdm_filament_pla.json @@ -1,46 +1,43 @@ { "type": "filament", "name": "fdm_filament_pla", + "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "inherits": "fdm_filament_common", "fan_cooling_layer_time": [ "100" ], "filament_max_volumetric_speed": [ "12" ], - "filament_type": [ - "PLA" - ], "filament_density": [ "1.24" ], "filament_cost": [ "20" ], - "cool_plate_temp" : [ + "cool_plate_temp": [ "35" ], - "eng_plate_temp" : [ + "eng_plate_temp": [ "0" ], - "hot_plate_temp" : [ + "hot_plate_temp": [ "55" ], - "textured_plate_temp" : [ + "textured_plate_temp": [ "55" ], - "cool_plate_temp_initial_layer" : [ + "cool_plate_temp_initial_layer": [ "35" ], - "eng_plate_temp_initial_layer" : [ + "eng_plate_temp_initial_layer": [ "0" ], - "hot_plate_temp_initial_layer" : [ + "hot_plate_temp_initial_layer": [ "55" ], - "textured_plate_temp_initial_layer" : [ + "textured_plate_temp_initial_layer": [ "55" ], "nozzle_temperature_initial_layer": [ @@ -49,18 +46,9 @@ "reduce_fan_stop_start_freq": [ "1" ], - "slow_down_for_layer_cooling": [ - "1" - ], - "fan_max_speed": [ - "100" - ], "fan_min_speed": [ "100" ], - "overhang_fan_speed": [ - "100" - ], "overhang_fan_threshold": [ "50%" ], @@ -89,6 +77,6 @@ "70" ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_ppa.json b/resources/profiles/BBL/filament/fdm_filament_ppa.json new file mode 100644 index 000000000..23b082b05 --- /dev/null +++ b/resources/profiles/BBL/filament/fdm_filament_ppa.json @@ -0,0 +1,91 @@ +{ + "type": "filament", + "name": "fdm_filament_ppa", + "inherits": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "activate_air_filtration": [ + "1" + ], + "cool_plate_temp": [ + "0" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp": [ + "100" + ], + "eng_plate_temp_initial_layer": [ + "100" + ], + "fan_cooling_layer_time": [ + "5" + ], + "fan_max_speed": [ + "30" + ], + "fan_min_speed": [ + "10" + ], + "filament_cost": [ + "20" + ], + "filament_density": [ + "1.17" + ], + "filament_flow_ratio": [ + "0.96" + ], + "filament_max_volumetric_speed": [ + "8" + ], + "filament_type": [ + "PPA-CF" + ], + "filament_vendor": [ + "Bambu Lab" + ], + "hot_plate_temp": [ + "100" + ], + "hot_plate_temp_initial_layer": [ + "100" + ], + "nozzle_temperature": [ + "290" + ], + "nozzle_temperature_initial_layer": [ + "290" + ], + "nozzle_temperature_range_high": [ + "320" + ], + "nozzle_temperature_range_low": [ + "280" + ], + "overhang_fan_speed": [ + "40" + ], + "overhang_fan_threshold": [ + "0%" + ], + "required_nozzle_HRC": [ + "40" + ], + "slow_down_layer_time": [ + "2" + ], + "slow_down_min_speed": [ + "20" + ], + "temperature_vitrification": [ + "210" + ], + "textured_plate_temp": [ + "100" + ], + "textured_plate_temp_initial_layer": [ + "100" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pps.json b/resources/profiles/BBL/filament/fdm_filament_pps.json new file mode 100644 index 000000000..a3f104b6f --- /dev/null +++ b/resources/profiles/BBL/filament/fdm_filament_pps.json @@ -0,0 +1,79 @@ +{ + "type": "filament", + "name": "fdm_filament_pps", + "inherits": "fdm_filament_common", + "from": "system", + "instantiation": "false", + "chamber_temperatures": [ + "60" + ], + "cool_plate_temp": [ + "0" + ], + "cool_plate_temp_initial_layer": [ + "0" + ], + "eng_plate_temp": [ + "110" + ], + "eng_plate_temp_initial_layer": [ + "110" + ], + "fan_cooling_layer_time": [ + "5" + ], + "fan_max_speed": [ + "50" + ], + "fan_min_speed": [ + "0" + ], + "filament_density": [ + "1.36" + ], + "filament_flow_ratio": [ + "0.96" + ], + "filament_max_volumetric_speed": [ + "4" + ], + "filament_type": [ + "PPS" + ], + "hot_plate_temp": [ + "110" + ], + "hot_plate_temp_initial_layer": [ + "110" + ], + "nozzle_temperature": [ + "320" + ], + "nozzle_temperature_initial_layer": [ + "320" + ], + "nozzle_temperature_range_high": [ + "340" + ], + "nozzle_temperature_range_low": [ + "300" + ], + "overhang_fan_speed": [ + "30" + ], + "overhang_fan_threshold": [ + "0%" + ], + "slow_down_layer_time": [ + "2" + ], + "temperature_vitrification": [ + "125" + ], + "textured_plate_temp": [ + "110" + ], + "textured_plate_temp_initial_layer": [ + "110" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_pva.json b/resources/profiles/BBL/filament/fdm_filament_pva.json index 4253f3616..870a18368 100644 --- a/resources/profiles/BBL/filament/fdm_filament_pva.json +++ b/resources/profiles/BBL/filament/fdm_filament_pva.json @@ -1,91 +1,91 @@ { "type": "filament", "name": "fdm_filament_pva", + "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "inherits": "fdm_filament_common", + "additional_cooling_fan_speed": [ + "70" + ], + "close_fan_the_first_x_layers": [ + "1" + ], "cool_plate_temp": [ "45" ], + "cool_plate_temp_initial_layer": [ + "45" + ], "eng_plate_temp": [ "0" ], - "hot_plate_temp": [ - "55" - ], - "textured_plate_temp": [ - "55" - ], - "cool_plate_temp_initial_layer": [ - "45" - ], "eng_plate_temp_initial_layer": [ "0" ], - "hot_plate_temp_initial_layer": [ - "55" - ], - "textured_plate_temp_initial_layer": [ - "55" - ], "fan_cooling_layer_time": [ "100" ], + "fan_min_speed": [ + "100" + ], + "filament_cost": [ + "20" + ], + "filament_density": [ + "1.24" + ], + "filament_is_support": [ + "1" + ], "filament_max_volumetric_speed": [ "15" ], "filament_soluble": [ "1" ], - "filament_is_support": [ - "1" - ], "filament_type": [ "PVA" ], - "filament_density": [ - "1.24" + "hot_plate_temp": [ + "55" ], - "filament_cost": [ - "20" - ], - "nozzle_temperature_initial_layer": [ - "220" - ], - "reduce_fan_stop_start_freq": [ - "1" - ], - "fan_min_speed": [ - "100" - ], - "overhang_fan_threshold": [ - "50%" - ], - "close_fan_the_first_x_layers": [ - "1" + "hot_plate_temp_initial_layer": [ + "55" ], "nozzle_temperature": [ "220" ], - "temperature_vitrification": [ - "55" - ], - "nozzle_temperature_range_low": [ - "190" + "nozzle_temperature_initial_layer": [ + "220" ], "nozzle_temperature_range_high": [ "240" ], - "slow_down_min_speed": [ - "50" + "nozzle_temperature_range_low": [ + "190" + ], + "overhang_fan_threshold": [ + "50%" + ], + "reduce_fan_stop_start_freq": [ + "1" ], "slow_down_layer_time": [ "4" ], - "additional_cooling_fan_speed": [ - "70" + "slow_down_min_speed": [ + "50" + ], + "temperature_vitrification": [ + "55" + ], + "textured_plate_temp": [ + "55" + ], + "textured_plate_temp_initial_layer": [ + "55" ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >45)||(bed_temperature_initial_layer[current_extruder] >45)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/filament/fdm_filament_tpu.json b/resources/profiles/BBL/filament/fdm_filament_tpu.json index 5c490e0af..126c10139 100644 --- a/resources/profiles/BBL/filament/fdm_filament_tpu.json +++ b/resources/profiles/BBL/filament/fdm_filament_tpu.json @@ -1,79 +1,79 @@ { "type": "filament", "name": "fdm_filament_tpu", + "inherits": "fdm_filament_common", "from": "system", "instantiation": "false", - "inherits": "fdm_filament_common", - "cool_plate_temp": [ - "30" - ], - "eng_plate_temp": [ - "30" - ], - "hot_plate_temp": [ - "35" - ], - "textured_plate_temp": [ - "35" - ], - "cool_plate_temp_initial_layer": [ - "30" - ], - "eng_plate_temp_initial_layer": [ - "30" - ], - "hot_plate_temp_initial_layer": [ - "35" - ], - "textured_plate_temp_initial_layer": [ - "35" - ], - "fan_cooling_layer_time": [ - "100" - ], - "filament_max_volumetric_speed": [ - "15" - ], - "filament_type": [ - "TPU" - ], - "filament_density": [ - "1.24" - ], - "filament_cost": [ - "20" - ], - "filament_retraction_length": [ - "0.4" - ], - "nozzle_temperature_initial_layer": [ - "240" - ], - "reduce_fan_stop_start_freq": [ - "1" - ], - "fan_min_speed": [ - "100" - ], "additional_cooling_fan_speed": [ "70" ], "close_fan_the_first_x_layers": [ "1" ], + "cool_plate_temp": [ + "30" + ], + "cool_plate_temp_initial_layer": [ + "30" + ], + "eng_plate_temp": [ + "30" + ], + "eng_plate_temp_initial_layer": [ + "30" + ], + "fan_cooling_layer_time": [ + "100" + ], + "fan_min_speed": [ + "100" + ], + "filament_cost": [ + "20" + ], + "filament_density": [ + "1.24" + ], + "filament_max_volumetric_speed": [ + "15" + ], + "filament_retraction_length": [ + "0.4" + ], + "filament_type": [ + "TPU" + ], + "hot_plate_temp": [ + "35" + ], + "hot_plate_temp_initial_layer": [ + "35" + ], "nozzle_temperature": [ "240" ], - "temperature_vitrification": [ - "35" - ], - "nozzle_temperature_range_low": [ - "200" + "nozzle_temperature_initial_layer": [ + "240" ], "nozzle_temperature_range_high": [ "250" ], + "nozzle_temperature_range_low": [ + "200" + ], + "reduce_fan_stop_start_freq": [ + "1" + ], + "temperature_vitrification": [ + "35" + ], + "textured_plate_temp": [ + "35" + ], + "textured_plate_temp_initial_layer": [ + "35" + ], "filament_start_gcode": [ - "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif}" + "; filament start gcode\n{if (bed_temperature[current_extruder] >35)||(bed_temperature_initial_layer[current_extruder] >35)}M106 P3 S255\n{elsif(bed_temperature[current_extruder] >30)||(bed_temperature_initial_layer[current_extruder] >30)}M106 P3 S180\n{endif}\n\n{if activate_air_filtration[current_extruder] && support_air_filtration}\nM106 P3 S{during_print_exhaust_fan_speed_num[current_extruder]} \n{endif}" ] } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.2 nozzle.json new file mode 100644 index 000000000..d8cea9951 --- /dev/null +++ b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.2 nozzle.json @@ -0,0 +1,32 @@ +{ + "type": "machine", + "name": "Bambu Lab A1 mini 0.2 nozzle", + "inherits": "Bambu Lab A1 mini 0.4 nozzle", + "from": "system", + "setting_id": "GM021", + "instantiation": "true", + "nozzle_diameter": [ + "0.2" + ], + "printer_model": "Bambu Lab A1 mini", + "printer_variant": "0.2", + "default_filament_profile": [ + "Bambu PLA Basic @BBL A1M 0.2 nozzle" + ], + "default_print_profile": "0.10mm Standard @BBL A1M 0.2 nozzle", + "max_layer_height": [ + "0.14" + ], + "min_layer_height": [ + "0.04" + ], + "retraction_length": [ + "0.4" + ], + "upward_compatible_machine": [ + "Bambu Lab P1S 0.2 nozzle", + "Bambu Lab P1P 0.2 nozzle", + "Bambu Lab X1 0.2 nozzle", + "Bambu Lab X1 Carbon 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json new file mode 100644 index 000000000..d78a910e6 --- /dev/null +++ b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.4 nozzle.json @@ -0,0 +1,66 @@ +{ + "type": "machine", + "name": "Bambu Lab A1 mini 0.4 nozzle", + "inherits": "fdm_bbl_3dp_001_common", + "from": "system", + "setting_id": "GM020", + "instantiation": "true", + "nozzle_diameter": [ + "0.4" + ], + "printer_model": "Bambu Lab A1 mini", + "printer_variant": "0.4", + "auxiliary_fan": "0", + "bed_exclude_area": [], + "best_object_pos": "0.7x0.5", + "default_filament_profile": [ + "Bambu PLA Basic @BBL A1M" + ], + "default_print_profile": "0.20mm Standard @BBL A1M", + "extruder_clearance_height_to_rod": "25", + "extruder_clearance_max_radius": "73", + "extruder_clearance_radius": "73", + "machine_load_filament_time": "28", + "machine_max_acceleration_z": [ + "1500", + "1500" + ], + "machine_max_jerk_e": [ + "3", + "3" + ], + "machine_max_jerk_z": [ + "5", + "5" + ], + "machine_max_speed_z": [ + "30", + "30" + ], + "machine_unload_filament_time": "34", + "nozzle_type": "stainless_steel", + "nozzle_volume": "32", + "printable_area": [ + "0x0", + "180x0", + "180x180", + "0x180" + ], + "printable_height": "180", + "retract_lift_below":[ + "179" + ], + "printer_structure": "i3", + "scan_first_layer": "0", + "upward_compatible_machine": [ + "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1P 0.4 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 Carbon 0.4 nozzle" + ], + "machine_start_gcode": ";===== machine: A1 mini =========================\n;===== date: 20230912 =====================\n\n;===== start to heat heatbead&hotend==========\nM1002 gcode_claim_action : 2\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\nM104 S140\nM140 S[bed_temperature_initial_layer_single]\nG392 S0 ;turn off clog detect\n;=====start printer sound ===================\nM17\nM400 S1\nM1006 S1\nM1006 A0 B0 L100 C37 D10 M100 E37 F10 N100\nM1006 A0 B0 L100 C41 D10 M100 E41 F10 N100\nM1006 A0 B0 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A43 B10 L100 C39 D10 M100 E46 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C39 D10 M100 E43 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C41 D10 M100 E41 F10 N100\nM1006 A0 B0 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B0 L100 C49 D10 M100 E49 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A44 B10 L100 C39 D10 M100 E48 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B0 L100 C39 D10 M100 E44 F10 N100\nM1006 A0 B0 L100 C0 D10 M100 E0 F10 N100\nM1006 A43 B10 L100 C39 D10 M100 E46 F10 N100\nM1006 W\nM18\n;=====avoid end stop =================\nG91\nG380 S2 Z30 F1200\nG380 S2 Z-20 F1200\nG1 Z5 F1200\nG90\n\n;===== reset machine status =================\nM290 X39 Y39 Z8\nM204 S6000\n\nM630 S0 P0\nG91\nM17 Z0.3 ; lower the z-motor current\n\nG90\nM17 X0.7 Y0.9 Z0.5 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\n;M221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\n;====== cog noise reduction=================\nM982.2 S1 ; turn on cog noise reduction\n\n;===== prepare print temperature and material ==========\nM1002 gcode_claim_action : 1\nM400\nM18\nM109 S100\nM104 S140\nM400\nM17\nM400\nG28 X\n\nM221 X0 Y0 Z0 ;turn off soft endstop\n\nM975 S1 ; turn on\n\nG1 X0.0 F30000\nG1 X-13.5 F3000\n\nM620 M ;enable remap\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n G392 S1 ;turn on clog detect\n M1002 gcode_claim_action : 4\n M400\n M1002 set_filament_type:UNKNOWN\n M109 S[nozzle_temperature_initial_layer]\n M104 S250\n M400\n T[initial_no_support_extruder]\n G1 X-13.5 F3000\n M400\n M620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n M109 S250 ;set nozzle to common flush temp\n M106 P1 S0\n G92 E0\n G1 E50 F200\n M400\n M1002 set_filament_type:{filament_type[initial_no_support_extruder]}\n M104 S{nozzle_temperature_range_high[initial_no_support_extruder]}\n G92 E0\n G1 E50 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60}\n M400\n M106 P1 S178\n G92 E0\n G1 E5 F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60}\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-40}\n G92 E0\n G1 E-0.5 F300\n\n G1 X0 F30000\n G1 X-13.5 F3000\n G1 X0 F30000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n G1 X0 F30000\n G1 X-13.5 F3000\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-40}\n G392 S0 ;turn off clog detect\nM621 S[initial_no_support_extruder]A\n\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== mech mode fast check============================\nM1002 gcode_claim_action : 3\nG0 X50 Y175 F20000 ; find a soft place to home\nM104 S0\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-80}\n\nG1 X90 Y-1 Z5 F30000\nM400 P200\nM970.3 Q1 A7 K0 O2\nM974 Q1 S2 P0\n\nG1 X90 Y0 Z5 F30000\nM400 P200\nM970 Q0 A5 B55 C85 H15 K0 M20 O2\n;M970.3 Q0 A7 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X-1 Y10\nG28 X ; re-home XY\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\n;M106 S255\nG29.2 S0 ; turn off ABL\nG0 X50 Y175 F20000 ; find a soft place to home\nG28 Z P0 T300; home z with low precision, permit 300deg temperature\n\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\n\nG0 X85 Y185 F10000 ;move to exposed steel surface and stop the nozzle\nG0 Z-1.01 F10000\nG91\n\nG2 I1 J0 X2 Y0 F2000.1\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\nG2 I1 J0 X2\nG2 I-0.75 J0 X-1.5\n\nG90\nG1 Z5 F30000\nG1 X32 Y185 F30000.1 ;Brush material\nG1 Z0.6 F30000.1\nG91\nG1 X-30 F30000\nG1 Y-2\nG1 X27\nG1 Y1.5\nG1 X-28\nG1 Y-2\nG1 X30\nG1 Y1.5\nG1 X-30\n\nG90\nM83\n\nG1 Z10\nG1 X85 Y185\nG1 Z-1.01\n\n\nM221 R; pop softend status\n\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== wait heatbed ====================\nM1002 gcode_claim_action : 2\nM104 S0\nM190 S[bed_temperature_initial_layer_single];set bed temp\nM109 S140\n\nG1 Z5 F3000\nG29.2 S1\nG1 X10 Y10 F20000\n\n;===== bed leveling ==================================\n;M1002 set_flag g29_before_print_flag=1\nM1002 judge_flag g29_before_print_flag\nM622 J1\n M1002 gcode_claim_action : 1\n G29 A\n M400\n M500 ; save cali data\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\n\nG1 X-13.5 Y0 Z10 F10000\nM400\nM1002 set_filament_type:UNKNOWN\nM109 S{nozzle_temperature[initial_extruder]}\nM400\n\nM412 S1 ; ===turn on filament runout detection===\nM400 P10\n\nG392 S1 ;turn on clog detect\n\nM620.3 W1; === turn on filament tangle detection===\nM400 S2\n\nM1002 set_filament_type:{filament_type[initial_no_support_extruder]}\n;M1002 set_flag extrude_cali_flag=1\nM1002 judge_flag extrude_cali_flag\nM622 J1\n M1002 gcode_claim_action : 8\n \n M400\n M900 K0.0 L1000.0 M1.0\n G90\n M83\n G0 X45 Y-4 F30000\n G0 Z0.2 F18000 ;Move to start position\n G0 X65 E10 F{outer_wall_volumetric_speed/(24/20) * 60}\n G0 X70 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X75 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X80 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X85 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X90 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X95 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X100 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X105 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X110 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X115 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X120 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n G0 X125 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X130 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\n M400\n \n G1 X-13.5 Y0 Z10 F10000\n M400\n \n G1 E10 F{outer_wall_volumetric_speed/2.4*60}\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 ; cali dynamic extrusion compensation\n M106 P1 S178\n M400 S7\n G1 X0 F18000\n G1 X-13.5 F3000\n G1 X0 F18000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n G1 X-13.5 F3000\n M400\n M106 P1 S0\n\n M1002 judge_last_extrude_cali_success\n M622 J0\n M983 F{outer_wall_volumetric_speed/2.4} A0.3 ; cali dynamic extrusion compensation\n M106 P1 S178\n M400 S7\n G1 X0 F18000\n G1 X-13.5 F3000\n G1 X0 F18000 ;wipe and shake\n G1 X-13.5 F3000\n G1 X0 F12000 ;wipe and shake\n M400\n M106 P1 S0\n M623\nM623 ; end of \"draw extrinsic para cali paint\"\n\n;===== extrude cali test ===============================\nG90\nM83\nG0 X50 Y-2.7 F30000\nG0 Z0.2 F18000 ;Move to start position\nG0 X60 E4 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X65 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X70 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X75 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X80 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X85 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X90 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X95 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X100 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X105 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X110 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X115 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X120 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nG0 X125 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 X130 E.3742 F{outer_wall_volumetric_speed/(0.3*0.5)/4 * 60}\nM400\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\n\nM400 ; wait all motion done before implement the emprical L parameters\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.02} ; for Textured PEI Plate\n{endif}\n\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\n\nM211 X0 Y0 Z0 ;turn off soft endstop\n", + "machine_end_gcode": ";===== date: 20230912 =====================\n;turn off nozzle clog detect\nG392 S0\n\n{if timelapse_type == 2}\nM991 S0 P-1 ;end timelapse immediately\n{endif}\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X0 F12000 ; move to safe pos \n{if timelapse_type == 1}\nM991 S0 P-1 ;end timelapse at safe pos\n{endif}\n\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\n;G1 X27 F15000 ; wipe\n\n; pull back filament to AMS\nM620 S255\nG1 X181 F12000\nT255\nG1 X0 F18000\nG1 X-13.0 F3000\nG1 X0 F18000 ; wipe\nM621 S255\n\nM104 S0 ; turn off hotend\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 180}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z180 F600\n G1 Z180\n{endif}\nM400 P100\nM17 R ; restore z current\n\nG90\nG1 X-13 Y180 F3600\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\n;=====printer finish sound=========\nM17\nM400 S1\nM1006 S1\nM1006 A0 B20 L100 C37 D20 M100 E42 F20 N100\nM1006 A0 B10 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C46 D10 M100 E46 F10 N100\nM1006 A44 B20 L100 C39 D20 M100 E48 F20 N100\nM1006 A0 B10 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B10 L100 C39 D10 M100 E39 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B10 L100 C44 D10 M100 E44 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A0 B10 L100 C39 D10 M100 E39 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A44 B10 L100 C0 D10 M100 E48 F10 N100\nM1006 A0 B10 L100 C0 D10 M100 E0 F10 N100\nM1006 A44 B20 L100 C41 D20 M100 E49 F20 N100\nM1006 A0 B20 L100 C0 D20 M100 E0 F20 N100\nM1006 A0 B20 L100 C37 D20 M100 E37 F20 N100\nM1006 W\n;=====printer finish sound=========\nM400 S1\nM18\n", + "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change\n", + "time_lapse_gcode": "{if !spiral_mode && print_sequence != \"by object\"}\n;===================== date: 20230922 =====================\n; timelapse gcode\n; don't support timelapse gcode in spiral_mode and by object sequence for I3 structure printer\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\nG92 E0\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 Z{max_layer_z + 0.4}\nG1 X0 Y{first_layer_center_no_wipe_tower[1]} F18000 ; move to safe pos\nG1 X-13.0 F3000 ; move to safe pos\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 X0 F18000\nM623\n\n{if layer_num == 2}\n M400\n G90\n M83\n M204 S5000\n G0 Z2 F4000\n G0 X-6 Y170 F20000\n M400 P200\n G39 S1\n G0 Z2 F4000\n G0 X90 Y90 F30000\n{endif}\n\n{endif}\n", + "change_filament_gcode": ";===== machine: A1 mini =========================\n;===== date: 20230913 =======================\nG392 S0\nM620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1}\nG17\nG2 Z{max_layer_z + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\n\nG1 X180 F18000\n;{if toolchange_count == 2}\n; get travel path for change filament\n;M620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\n;M620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\n;M620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n;{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\nG1 Y90 F9000\n\n{if next_extruder < 255}\nM400\n\nG92 E0\n{if flush_length_1 > 1}\n; FLUSH_START\n; always use highest temperature to flush\nM400\nM1002 set_filament_type:UNKNOWN\nM109 S[nozzle_temperature_range_high]\nM106 P1 S60\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\nM400\nM1002 set_filament_type:{filament_type[next_extruder]}\n{endif}\n\n{if flush_length_1 > 45 && flush_length_2 > 1}\n; WIPE\nM400\nM106 P1 S178\nM400 S3\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nM400\nM106 P1 S0\n{endif}\n\n{if flush_length_2 > 1}\nM106 P1 S60\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 45 && flush_length_3 > 1}\n; WIPE\nM400\nM106 P1 S178\nM400 S3\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nM400\nM106 P1 S0\n{endif}\n\n{if flush_length_3 > 1}\nM106 P1 S60\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 45 && flush_length_4 > 1}\n; WIPE\nM400\nM106 P1 S178\nM400 S3\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nM400\nM106 P1 S0\n{endif}\n\n{if flush_length_4 > 1}\nM106 P1 S60\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n\n; FLUSH_START\nM400\nM106 P1 S60\nM109 S[new_filament_temp]\nG1 E5 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM400\nM106 P1 S178\nM400 S3\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nG1 X-13.5 F3000\nG1 X-3.5 F18000\nM400\nG1 Z{max_layer_z + 3.0} F3000\nM106 P1 S0\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A\nG392 S1\n" +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.6 nozzle.json new file mode 100644 index 000000000..3ef6460dc --- /dev/null +++ b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.6 nozzle.json @@ -0,0 +1,33 @@ +{ + "type": "machine", + "name": "Bambu Lab A1 mini 0.6 nozzle", + "inherits": "Bambu Lab A1 mini 0.4 nozzle", + "from": "system", + "setting_id": "GM022", + "instantiation": "true", + "nozzle_diameter": [ + "0.6" + ], + "printer_model": "Bambu Lab A1 mini", + "printer_variant": "0.6", + "default_print_profile": "0.30mm Standard @BBL A1M 0.6 nozzle", + "max_layer_height": [ + "0.42" + ], + "min_layer_height": [ + "0.12" + ], + "nozzle_type": "hardened_steel", + "retraction_length": [ + "1.4" + ], + "retraction_minimum_travel": [ + "3" + ], + "upward_compatible_machine": [ + "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1P 0.6 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.8 nozzle.json new file mode 100644 index 000000000..82fcdb814 --- /dev/null +++ b/resources/profiles/BBL/machine/Bambu Lab A1 mini 0.8 nozzle.json @@ -0,0 +1,33 @@ +{ + "type": "machine", + "name": "Bambu Lab A1 mini 0.8 nozzle", + "inherits": "Bambu Lab A1 mini 0.4 nozzle", + "from": "system", + "setting_id": "GM023", + "instantiation": "true", + "nozzle_diameter": [ + "0.8" + ], + "printer_model": "Bambu Lab A1 mini", + "printer_variant": "0.8", + "default_print_profile": "0.40mm Standard @BBL A1M 0.8 nozzle", + "max_layer_height": [ + "0.56" + ], + "min_layer_height": [ + "0.16" + ], + "nozzle_type": "hardened_steel", + "retract_length_toolchange": [ + "3" + ], + "retraction_length": [ + "3" + ], + "upward_compatible_machine": [ + "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab P1P 0.8 nozzle", + "Bambu Lab X1 0.8 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab A1 mini.json b/resources/profiles/BBL/machine/Bambu Lab A1 mini.json new file mode 100644 index 000000000..c32ab2c90 --- /dev/null +++ b/resources/profiles/BBL/machine/Bambu Lab A1 mini.json @@ -0,0 +1,12 @@ +{ + "type": "machine_model", + "name": "Bambu Lab A1 mini", + "nozzle_diameter": "0.4;0.2;0.6;0.8", + "model_id": "N1", + "url": "http://www.bambulab.com/Parameters/printer_model/Bambu Lab X1.json", + "machine_tech": "FFF", + "family": "BBL-3DP", + "bed_model": "bbl-3dp-A1M.stl", + "bed_texture": "bbl-3dp-logo.svg", + "default_materials": "Generic PLA @BBL A1M;Generic PLA Silk @BBL A1M;Bambu PLA Matte @BBL A1M;Bambu PLA Basic @BBL A1M;Bambu ABS @BBL P1P;Bambu PC @BBL P1P;Bambu Support W @BBL A1M;Bambu TPU 95A @BBL P1P;PolyTerra PLA @BBL A1M;PolyLite PLA @BBL A1M;" +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json index f759e9e04..31aa9e7c8 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "machine", - "setting_id": "GM010", "name": "Bambu Lab P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab P1P 0.4 nozzle", + "from": "system", + "setting_id": "GM010", + "instantiation": "true", "nozzle_diameter": [ "0.2" ], @@ -14,7 +14,6 @@ "Bambu PLA Basic @BBL X1C 0.2 nozzle" ], "default_print_profile": "0.10mm Standard @BBL P1P 0.2 nozzle", - "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z-0.04 ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", "max_layer_height": [ "0.14" ], @@ -29,5 +28,5 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab X1 Carbon 0.2 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z-0.04 ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json index 3def72780..247608475 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.4 nozzle.json @@ -1,16 +1,16 @@ { "type": "machine", - "setting_id": "GM013", "name": "Bambu Lab P1P 0.4 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_bbl_3dp_001_common", + "from": "system", + "setting_id": "GM013", + "instantiation": "true", "nozzle_diameter": [ "0.4" ], "printer_model": "Bambu Lab P1P", "printer_variant": "0.4", - "auxiliary_fan": "1", + "auxiliary_fan": "0", "bed_exclude_area": [ "0x0", "18x0", @@ -24,16 +24,18 @@ "extruder_offset": [ "0x2" ], - "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n{if timelapse_type == 0} ; timelapse without wipe tower\nM971 S11 C10 O0\n{elsif timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 X65 Y245 F20000 ; move to safe pos\nG17\nG2 Z{layer_z} I0.86 J0.86 P1 F20000\nG1 Y265 F3000\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255 F20000\n{endif}\nM623\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change", "machine_load_filament_time": "29", - "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", "machine_unload_filament_time": "28", "nozzle_type": "stainless_steel", "scan_first_layer": "0", + "z_hop": [ + "0.4" + ], "upward_compatible_machine": [ "Bambu Lab P1S 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 Carbon 0.4 nozzle" ], - "version": "01.07.00.18" -} \ No newline at end of file + "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", + "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n{if timelapse_type == 0} ; timelapse without wipe tower\nM971 S11 C10 O0\n{elsif timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 X65 Y245 F20000 ; move to safe pos\nG17\nG2 Z{layer_z} I0.86 J0.86 P1 F20000\nG1 Y265 F3000\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255 F20000\n{endif}\nM623\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change" +} diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json index 3f5a1bb03..e2e35ce50 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.6 nozzle.json @@ -1,10 +1,10 @@ { "type": "machine", - "setting_id": "GM011", "name": "Bambu Lab P1P 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab P1P 0.4 nozzle", + "from": "system", + "setting_id": "GM011", + "instantiation": "true", "nozzle_diameter": [ "0.6" ], @@ -14,13 +14,15 @@ "Bambu PLA Basic @BBL X1" ], "default_print_profile": "0.30mm Standard @BBL P1P 0.6 nozzle", - "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X18 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", "max_layer_height": [ "0.42" ], "min_layer_height": [ "0.12" ], + "z_hop": [ + "0.4" + ], "nozzle_type": "hardened_steel", "retraction_length": [ "1.4" @@ -33,5 +35,5 @@ "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X18 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json index 23fcb62e7..04375fdf7 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P 0.8 nozzle.json @@ -1,10 +1,10 @@ { "type": "machine", - "setting_id": "GM012", "name": "Bambu Lab P1P 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab P1P 0.4 nozzle", + "from": "system", + "setting_id": "GM012", + "instantiation": "true", "nozzle_diameter": [ "0.8" ], @@ -14,7 +14,6 @@ "Bambu PLA Basic @BBL X1" ], "default_print_profile": "0.40mm Standard @BBL P1P 0.8 nozzle", - "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y15 E1.500 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.500\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X18 E15\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", "max_layer_height": [ "0.56" ], @@ -25,6 +24,9 @@ "retract_length_toolchange": [ "3" ], + "z_hop": [ + "0.4" + ], "retraction_length": [ "3" ], @@ -33,5 +35,5 @@ "Bambu Lab X1 0.8 nozzle", "Bambu Lab X1 Carbon 0.8 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: P1P ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y15 E1.500 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.500\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X18 E15\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1P.json b/resources/profiles/BBL/machine/Bambu Lab P1P.json index c48372c5d..ee2f9ec05 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1P.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1P.json @@ -1,13 +1,12 @@ { "type": "machine_model", "name": "Bambu Lab P1P", + "nozzle_diameter": "0.4;0.2;0.6;0.8", "model_id": "C11", "url": "http://www.bambulab.com/Parameters/printer_model/Bambu Lab X1.json", - "nozzle_diameter": "0.4;0.2;0.6;0.8", "machine_tech": "FFF", "family": "BBL-3DP", "bed_model": "bbl-3dp-X1.stl", "bed_texture": "bbl-3dp-logo.svg", - "hotend_model": "bbl-3dp-hotend.stl", "default_materials": "Generic PLA @BBL P1P;Generic PLA Silk @BBL P1P;Bambu PLA Matte @BBL P1P;Bambu PLA Basic @BBL P1P;Bambu ABS @BBL P1P;Bambu PC @BBL P1P;Bambu Support W @BBL P1P;Bambu TPU 95A @BBL P1P;PolyTerra PLA @BBL P1P;PolyLite PLA @BBL P1P;" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json index 1508e7015..2ef87a37a 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "machine", - "setting_id": "GM015", "name": "Bambu Lab P1S 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab P1S 0.4 nozzle", + "from": "system", + "setting_id": "GM015", + "instantiation": "true", "nozzle_diameter": [ "0.2" ], @@ -14,7 +14,6 @@ "Bambu PLA Basic @BBL X1C 0.2 nozzle" ], "default_print_profile": "0.10mm Standard @BBL P1P 0.2 nozzle", - "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z-0.04 ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", "max_layer_height": [ "0.14" ], @@ -29,5 +28,5 @@ "Bambu Lab X1 0.2 nozzle", "Bambu Lab X1 Carbon 0.2 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z-0.04 ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json index 340ff7507..8fd2c82da 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.4 nozzle.json @@ -1,10 +1,10 @@ { "type": "machine", - "setting_id": "GM014", "name": "Bambu Lab P1S 0.4 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_bbl_3dp_001_common", + "from": "system", + "setting_id": "GM014", + "instantiation": "true", "nozzle_diameter": [ "0.4" ], @@ -16,20 +16,25 @@ "18x28", "0x28" ], + "default_filament_profile": [ + "Bambu PLA Basic @BBL X1C" + ], "default_print_profile": "0.20mm Standard @BBL X1C", "extruder_offset": [ "0x2" ], - "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n{if timelapse_type == 0} ; timelapse without wipe tower\nM971 S11 C10 O0\n{elsif timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 X65 Y245 F20000 ; move to safe pos\nG17\nG2 Z{layer_z} I0.86 J0.86 P1 F20000\nG1 Y265 F3000\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255 F20000\n{endif}\nM623\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change", "machine_load_filament_time": "29", - "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", "machine_unload_filament_time": "28", "nozzle_type": "stainless_steel", "scan_first_layer": "0", + "z_hop": [ + "0.4" + ], "upward_compatible_machine": [ "Bambu Lab P1P 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab X1 Carbon 0.4 nozzle" ], - "version": "01.07.00.18" -} \ No newline at end of file + "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", + "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n{if timelapse_type == 0} ; timelapse without wipe tower\nM971 S11 C10 O0\n{elsif timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 X65 Y245 F20000 ; move to safe pos\nG17\nG2 Z{layer_z} I0.86 J0.86 P1 F20000\nG1 Y265 F3000\nM400 P300\nM971 S11 C11 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255 F20000\n{endif}\nM623\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change" +} diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json index b8586b9a6..dbae519da 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.6 nozzle.json @@ -1,17 +1,19 @@ { "type": "machine", - "setting_id": "GM016", "name": "Bambu Lab P1S 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab P1S 0.4 nozzle", + "from": "system", + "setting_id": "GM016", + "instantiation": "true", "nozzle_diameter": [ "0.6" ], "printer_model": "Bambu Lab P1S", "printer_variant": "0.6", + "z_hop": [ + "0.4" + ], "default_print_profile": "0.30mm Standard @BBL X1C 0.6 nozzle", - "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X18 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", "max_layer_height": [ "0.42" ], @@ -30,5 +32,5 @@ "Bambu Lab X1 0.6 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X18 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json index 6bf1b1118..8c48198d3 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S 0.8 nozzle.json @@ -1,20 +1,22 @@ { "type": "machine", - "setting_id": "GM017", "name": "Bambu Lab P1S 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab P1S 0.4 nozzle", + "from": "system", + "setting_id": "GM017", + "instantiation": "true", "nozzle_diameter": [ "0.8" ], "printer_model": "Bambu Lab P1S", "printer_variant": "0.8", + "z_hop": [ + "0.4" + ], "default_filament_profile": [ "Bambu PLA Basic @BBL X1" ], "default_print_profile": "0.40mm Standard @BBL X1C 0.8 nozzle", - "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y15 E1.500 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.500\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X18 E15\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression", "max_layer_height": [ "0.56" ], @@ -33,5 +35,5 @@ "Bambu Lab X1 0.8 nozzle", "Bambu Lab X1 Carbon 0.8 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: P1S ========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X230 Y15\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_extruder]==\"PLA\"}\n {if (bed_temperature[initial_extruder] >45)||(bed_temperature_initial_layer[initial_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_extruder] >50)||(bed_temperature_initial_layer[initial_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n\nM104 S{nozzle_temperature_initial_layer[initial_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== fmech mode fast check============================\n\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature_initial_layer[initial_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y15 E1.500 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.500\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X18 E15\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab P1S.json b/resources/profiles/BBL/machine/Bambu Lab P1S.json index 340e1ec50..407df99c0 100644 --- a/resources/profiles/BBL/machine/Bambu Lab P1S.json +++ b/resources/profiles/BBL/machine/Bambu Lab P1S.json @@ -1,14 +1,12 @@ { - "type": "machine_model", - "name": "Bambu Lab P1S", - "model_id": "C12", - "url": "http://www.bambulab.com/Parameters/printer_model/Bambu Lab X1.json", - "nozzle_diameter": "0.4;0.2;0.6;0.8", - "machine_tech": "FFF", - "family": "BBL-3DP", - "bed_model": "bbl-3dp-X1.stl", - "bed_texture": "bbl-3dp-logo.svg", - "hotend_model": "bbl-3dp-hotend.stl", - "default_materials": "Generic PLA Silk;Generic PLA;Bambu PLA Matte @BBL X1;Bambu PLA Basic @BBL X1;Bambu ABS @BBL X1C;Bambu PC @BBL X1C;Bambu Support W @BBL X1;Bambu TPU 95A @BBL X1;PolyTerra PLA @BBL X1;PolyLite PLA @BBL X1;" -} - + "type": "machine_model", + "name": "Bambu Lab P1S", + "nozzle_diameter": "0.4;0.2;0.6;0.8", + "model_id": "C12", + "url": "http://www.bambulab.com/Parameters/printer_model/Bambu Lab X1.json", + "machine_tech": "FFF", + "family": "BBL-3DP", + "bed_model": "bbl-3dp-X1.stl", + "bed_texture": "bbl-3dp-logo.svg", + "default_materials": "Generic PLA Silk;Generic PLA;Bambu PLA Matte @BBL X1;Bambu PLA Basic @BBL X1;Bambu ABS @BBL X1C;Bambu PC @BBL X1C;Bambu Support W @BBL X1;Bambu TPU 95A @BBL X1;PolyTerra PLA @BBL X1;PolyLite PLA @BBL X1;" +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json index 85423dfc3..5c0352f9b 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "machine", - "setting_id": "GM008", "name": "Bambu Lab X1 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab X1 0.4 nozzle", + "from": "system", + "setting_id": "GM008", + "instantiation": "true", "nozzle_diameter": [ "0.2" ], @@ -14,7 +14,6 @@ "Bambu PLA Basic @BBL X1C 0.2 nozzle" ], "default_print_profile": "0.10mm Standard @BBL X1C 0.2 nozzle", - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", "max_layer_height": [ "0.14" ], @@ -25,9 +24,9 @@ "0.4" ], "upward_compatible_machine": [ - "Bambu Lab P1P 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", + "Bambu Lab P1P 0.2 nozzle", "Bambu Lab X1 Carbon 0.2 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json index 3a74c2ecf..69975f20e 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.4 nozzle.json @@ -1,16 +1,16 @@ { "type": "machine", - "setting_id": "GM003", "name": "Bambu Lab X1 0.4 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_bbl_3dp_001_common", + "from": "system", + "setting_id": "GM003", + "instantiation": "true", "nozzle_diameter": [ "0.4" ], "printer_model": "Bambu Lab X1", "printer_variant": "0.4", - "auxiliary_fan": "1", + "auxiliary_fan": "0", "bed_exclude_area": [ "0x0", "18x0", @@ -25,14 +25,16 @@ "0x2" ], "machine_load_filament_time": "29", - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", "machine_unload_filament_time": "28", "nozzle_type": "stainless_steel", "scan_first_layer": "1", + "z_hop": [ + "0.4" + ], "upward_compatible_machine": [ - "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1P 0.4 nozzle", "Bambu Lab X1 Carbon 0.4 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json index 22a55fd4b..b6e49250c 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.6 nozzle.json @@ -1,17 +1,19 @@ { "type": "machine", - "setting_id": "GM006", "name": "Bambu Lab X1 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab X1 0.4 nozzle", + "from": "system", + "setting_id": "GM006", + "instantiation": "true", "nozzle_diameter": [ "0.6" ], "printer_model": "Bambu Lab X1", "printer_variant": "0.6", + "z_hop": [ + "0.4" + ], "default_print_profile": "0.30mm Standard @BBL X1 0.6 nozzle", - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", "max_layer_height": [ "0.42" ], @@ -26,9 +28,9 @@ "3" ], "upward_compatible_machine": [ - "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1P 0.6 nozzle", "Bambu Lab X1 Carbon 0.6 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json index 2b43e519e..6a3b52e57 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 0.8 nozzle.json @@ -1,17 +1,19 @@ { "type": "machine", - "setting_id": "GM007", "name": "Bambu Lab X1 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab X1 0.4 nozzle", + "from": "system", + "setting_id": "GM007", + "instantiation": "true", "nozzle_diameter": [ "0.8" ], "printer_model": "Bambu Lab X1", "printer_variant": "0.8", + "z_hop": [ + "0.4" + ], "default_print_profile": "0.40mm Standard @BBL X1 0.8 nozzle", - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", "max_layer_height": [ "0.56" ], @@ -26,9 +28,9 @@ "3" ], "upward_compatible_machine": [ - "Bambu Lab P1P 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab P1P 0.8 nozzle", "Bambu Lab X1 Carbon 0.8 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json index a3cfc0829..84b682ce5 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.2 nozzle.json @@ -1,10 +1,10 @@ { "type": "machine", - "setting_id": "GM002", "name": "Bambu Lab X1 Carbon 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab X1 Carbon 0.4 nozzle", + "from": "system", + "setting_id": "GM002", + "instantiation": "true", "nozzle_diameter": [ "0.2" ], @@ -14,7 +14,6 @@ "Bambu PLA Basic @BBL X1C 0.2 nozzle" ], "default_print_profile": "0.10mm Standard @BBL X1C 0.2 nozzle", - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", "max_layer_height": [ "0.14" ], @@ -26,9 +25,9 @@ "0.4" ], "upward_compatible_machine": [ - "Bambu Lab P1P 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle", + "Bambu Lab P1P 0.2 nozzle", "Bambu Lab X1 0.2 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n\t{if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.160\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.080\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.080 K0.160\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.08 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.08}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json index 1fe32d5b4..8139efe73 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.4 nozzle.json @@ -1,10 +1,10 @@ { "type": "machine", - "setting_id": "GM001", "name": "Bambu Lab X1 Carbon 0.4 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_bbl_3dp_001_common", + "from": "system", + "setting_id": "GM001", + "instantiation": "true", "nozzle_diameter": [ "0.4" ], @@ -16,18 +16,24 @@ "18x28", "0x28" ], + "default_filament_profile": [ + "Bambu PLA Basic @BBL X1C" + ], "default_print_profile": "0.20mm Standard @BBL X1C", "extruder_offset": [ "0x2" ], "machine_load_filament_time": "29", - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", "machine_unload_filament_time": "28", "scan_first_layer": "1", + "z_hop": [ + "0.4" + ], + "printer_structure": "corexy", "upward_compatible_machine": [ - "Bambu Lab P1P 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle", + "Bambu Lab P1P 0.4 nozzle", "Bambu Lab X1 0.4 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y11 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E0.700\nG0 X231 E0.700 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n T1000\n\n G0 F1200.0 X231 Y15 Z0.2 E0.741\n G0 F1200.0 X226 Y15 Z0.2 E0.275\n G0 F1200.0 X226 Y8 Z0.2 E0.384\n G0 F1200.0 X216 Y8 Z0.2 E0.549\n G0 F1200.0 X216 Y1.5 Z0.2 E0.357\n\n G0 X48.0 E12.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E0.92 F1200.0\n G0 X35.0 Y6.0 E1.03 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E9.35441 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.040\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.020\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E14.3 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.020 K0.040\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E1.24726 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.02 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.02}\n M623\n\n G1 X140.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.31181 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json index 2e417137c..1aa8c9466 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.6 nozzle.json @@ -1,17 +1,19 @@ { "type": "machine", - "setting_id": "GM005", "name": "Bambu Lab X1 Carbon 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab X1 Carbon 0.4 nozzle", + "from": "system", + "setting_id": "GM005", + "instantiation": "true", "nozzle_diameter": [ "0.6" ], "printer_model": "Bambu Lab X1 Carbon", "printer_variant": "0.6", + "z_hop": [ + "0.4" + ], "default_print_profile": "0.30mm Standard @BBL X1C 0.6 nozzle", - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", "max_layer_height": [ "0.42" ], @@ -25,9 +27,9 @@ "3" ], "upward_compatible_machine": [ - "Bambu Lab P1P 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle", + "Bambu Lab P1P 0.6 nozzle", "Bambu Lab X1 0.6 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{+0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y1.0 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X240 E25 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nG0 Y15 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\nG0 X239.5\nG0 E0.2\nG0 Y1.5 E1.166\nG0 X231 E1.166 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.333\n G0 F1200.0 X226 Y15 Z0.2 E0.495\n G0 F1200.0 X226 Y8 Z0.2 E0.691\n G0 F1200.0 X216 Y8 Z0.2 E0.988\n G0 F1200.0 X216 Y1.5 Z0.2 E0.642\n\n G0 X48.0 E20.56 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.56 F1200.0\n G0 X35.0 Y6.0 E1.75 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X185.000 E16.9 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.030\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.015\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.9) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X18 E23.9 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.015 K0.030\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.25000 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X70.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X75.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X80.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X85.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X90.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X95.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X100.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X105.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X110.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X115.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X120.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X125.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X130.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X135.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.015 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*0.015}\n M623\n\n G1 X140.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X145.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X150.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X155.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X160.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X165.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X170.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X175.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X180.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X185.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X190.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X195.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X200.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X205.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X210.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X215.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G1 X220.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5)/ 4 * 60}\n G1 X225.000 E0.56250 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json index b5ec0a335..ac6d31e35 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon 0.8 nozzle.json @@ -1,20 +1,22 @@ { "type": "machine", - "setting_id": "GM004", "name": "Bambu Lab X1 Carbon 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "Bambu Lab X1 Carbon 0.4 nozzle", + "from": "system", + "setting_id": "GM004", + "instantiation": "true", "nozzle_diameter": [ "0.8" ], "printer_model": "Bambu Lab X1 Carbon", "printer_variant": "0.8", + "z_hop": [ + "0.4" + ], "default_filament_profile": [ "Bambu PLA Basic @BBL X1C 0.8 nozzle" ], "default_print_profile": "0.40mm Standard @BBL X1C 0.8 nozzle", - "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4", "max_layer_height": [ "0.56" ], @@ -28,9 +30,9 @@ "3" ], "upward_compatible_machine": [ - "Bambu Lab P1P 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle", + "Bambu Lab P1P 0.8 nozzle", "Bambu Lab X1 0.8 nozzle" ], - "version": "01.07.00.18" + "machine_start_gcode": ";===== machine: X1 =========================\n;===== date: 20230707 =====================\n;===== turn on the HB fan =================\nM104 S75 ;set extruder temp to turn on the HB fan and prevent filament oozing from nozzle\n;===== reset machine status =================\nG91\nM17 Z0.4 ; lower the z-motor current\nG380 S2 Z30 F300 ; G380 is same as G38; lower the hotbed , to prevent the nozzle is below the hotbed\nG380 S2 Z-25 F300 ;\nG1 Z5 F300;\nG90\nM17 X1.2 Y1.2 Z0.75 ; reset motor current to default\nM960 S5 P1 ; turn on logo lamp\nG90\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 5\nM221 X0 Y0 Z0 ; turn off soft endstop to prevent protential logic problem\nG29.1 Z{0.0} ; clear z-trim value first\nM204 S10000 ; init ACC set to 10m/s^2\n\n;===== heatbed preheat ====================\nM1002 gcode_claim_action : 2\nM140 S[bed_temperature_initial_layer_single] ;set bed temp\nM190 S[bed_temperature_initial_layer_single] ;wait for bed temp\n\n{if scan_first_layer}\n;=========register first layer scan=====\nM977 S1 P60\n{endif}\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\n;===== prepare print temperature and material ==========\nM104 S[nozzle_temperature_initial_layer] ;set extruder temp\nG91\nG0 Z10 F1200\nG90\nG28 X\nM975 S1 ; turn on\nG1 X60 F12000\nG1 Y245\nG1 Y265 F3000\nM620 M\nM620 S[initial_no_support_extruder]A ; switch material if AMS exist\n M109 S[nozzle_temperature_initial_layer]\n G1 X120 F12000\n\n G1 X20 Y50 F12000\n G1 Y-3\n T[initial_no_support_extruder]\n G1 X54 F12000\n G1 Y265\n M400\nM621 S[initial_no_support_extruder]A\nM620.1 E F{filament_max_volumetric_speed[initial_no_support_extruder]/2.4053*60} T{nozzle_temperature_range_high[initial_no_support_extruder]}\n\n\nM412 S1 ; ===turn on filament runout detection===\n\nM109 S250 ;set nozzle to common flush temp\nM106 P1 S0\nG92 E0\nG1 E50 F200\nM400\nM104 S[nozzle_temperature_initial_layer]\nG92 E0\nG1 E50 F200\nM400\nM106 P1 S255\nG92 E0\nG1 E5 F300\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20} ; drop nozzle temp, make filament shink a bit\nG92 E0\nG1 E-0.5 F300\n\nG1 X70 F9000\nG1 X76 F15000\nG1 X65 F15000\nG1 X76 F15000\nG1 X65 F15000; shake to put down garbage\nG1 X80 F6000\nG1 X95 F15000\nG1 X80 F15000\nG1 X165 F15000; wipe and shake\nM400\nM106 P1 S0\n;===== prepare print temperature and material end =====\n\n\n;===== wipe nozzle ===============================\nM1002 gcode_claim_action : 14\nM975 S1\nM106 S255\nG1 X65 Y230 F18000\nG1 Y264 F6000\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]-20}\nG1 X100 F18000 ; first wipe mouth\n\nG0 X135 Y253 F20000 ; move to exposed steel surface edge\nG28 Z P0 T300; home z with low precision,permit 300deg temperature\nG29.2 S0 ; turn off ABL\nG0 Z5 F20000\n\nG1 X60 Y265\nG92 E0\nG1 E-0.5 F300 ; retrack more\nG1 X100 F5000; second wipe mouth\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X100 F5000\nG1 X70 F15000\nG1 X90 F5000\nG0 X128 Y261 Z-1.5 F20000 ; move to exposed steel surface and stop the nozzle\nM104 S140 ; set temp down to heatbed acceptable\nM106 S255 ; turn on fan (G28 has turn off fan)\n\nM221 S; push soft endstop status\nM221 Z0 ;turn off Z axis endstop\nG0 Z0.5 F20000\nG0 X125 Y259.5 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y262.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y260.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.5\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 Z0.5 F20000\nG0 X125 Y261.0\nG0 Z-1.01\nG0 X131 F211\nG0 X124\nG0 X128\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\nG2 I0.5 J0 F300\n\nM109 S140 ; wait nozzle temp down to heatbed acceptable\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\nG2 I0.5 J0 F3000\n\nM221 R; pop softend status\nG1 Z10 F1200\nM400\nG1 Z10\nG1 F30000\nG1 X128 Y128\nG29.2 S1 ; turn on ABL\n;G28 ; home again after hard wipe mouth\nM106 S0 ; turn off fan , too noisy\n;===== wipe nozzle end ================================\n\n;===== check scanner clarity ===========================\nG1 X128 Y128 F24000\nG28 Z P0\nM972 S5 P0\nG1 X230 Y15 F24000\n;===== check scanner clarity end =======================\n\n;===== bed leveling ==================================\nM1002 judge_flag g29_before_print_flag\nM622 J1\n\n M1002 gcode_claim_action : 1\n G29 A X{first_layer_print_min[0]} Y{first_layer_print_min[1]} I{first_layer_print_size[0]} J{first_layer_print_size[1]}\n M400\n M500 ; save cali data\n\nM623\n;===== bed leveling end ================================\n\n;===== home after wipe mouth============================\nM1002 judge_flag g29_before_print_flag\nM622 J0\n\n M1002 gcode_claim_action : 13\n G28\n\nM623\n;===== home after wipe mouth end =======================\n\nM975 S1 ; turn on vibration supression\n\n;=============turn on fans to prevent PLA jamming=================\n{if filament_type[initial_no_support_extruder]==\"PLA\"}\n {if (bed_temperature[initial_no_support_extruder] >45)||(bed_temperature_initial_layer[initial_no_support_extruder] >45)}\n M106 P3 S180\n {elsif (bed_temperature[initial_no_support_extruder] >50)||(bed_temperature_initial_layer[initial_no_support_extruder] >50)}\n M106 P3 S255\n {endif};Prevent PLA from jamming\n{endif}\nM106 P2 S100 ; turn on big fan ,to cool down toolhead\n\nM104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; set extrude temp earlier, to reduce wait time\n\n;===== mech mode fast check============================\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q1 A7 B30 C80 H15 K0\nM974 Q1 S2 P0\n\nG1 X128 Y128 Z10 F20000\nM400 P200\nM970.3 Q0 A7 B30 C90 Q0 H15 K0\nM974 Q0 S2 P0\n\nM975 S1\nG1 F30000\nG1 X230 Y15\nG28 X ; re-home XY\n;===== mech mode fast check============================\n\n{if scan_first_layer}\n;start heatbed scan====================================\nM976 S2 P1\nG90\nG1 X128 Y128 F20000\nM976 S3 P2 ;register void printing detection\n{endif}\n\n;===== noozle load line ===============================\nM975 S1\nG90\nM83\nT1000\nG1 X18.0 Y0.5 Z0.8 F18000;Move to start position\nM109 S{nozzle_temperature[initial_no_support_extruder]}\nG1 Z0.2\nG0 E2 F300\nG0 X129 E15 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\nG0 X240 E15\nG0 Y11 E1.364 F{outer_wall_volumetric_speed/(0.3*1.0)/ 4 * 60}\nG0 X239.5\nG0 E0.3\nG0 Y1.5 E1.300\nG0 X231 E1.160 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM400\n\n;===== for Textured PEI Plate , lower the nozzle as the nozzle was touching topmost of the texture when homing ==\n;curr_bed_type={curr_bed_type}\n{if curr_bed_type==\"Textured PEI Plate\"}\nG29.1 Z{-0.04} ; for Textured PEI Plate\n{endif}\n\n;===== draw extrinsic para cali paint =================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M1002 gcode_claim_action : 8\n\n G0 F1200.0 X231 Y15 Z0.2 E1.482\n G0 F1200.0 X226 Y15 Z0.2 E0.550\n G0 F1200.0 X226 Y8 Z0.2 E0.768\n G0 F1200.0 X216 Y8 Z0.2 E1.098\n G0 F1200.0 X216 Y1.5 Z0.2 E0.714\n\n G0 X48.0 E25.0 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\n G0 X48.0 Y14 E1.70 F1200.0\n G0 X35.0 Y6.0 E1.90 F1200.0\n\n ;=========== extruder cali extrusion ==================\n T1000\n M83\n {if default_acceleration > 0}\n {if outer_wall_acceleration > 0}\n M204 S[outer_wall_acceleration]\n {else}\n M204 S[default_acceleration]\n {endif}\n {endif}\n G0 X35.000 Y6.000 Z0.300 F30000 E0\n G1 F1500.000 E0.800\n M106 S0 ; turn off fan\n G0 X110.000 E9.35441 F4800\n G0 X185.000 E9.35441 F4800\n G0 X187 Z0\n G1 F1500.000 E-0.800\n G0 Z1\n G0 X180 Z0.3 F18000\n\n M900 L1000.0 M1.0\n M900 K0.020\n G0 X45.000 F30000\n G0 Y8.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.010\n G0 X45.000 F30000\n G0 Y10.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n M400\n\n G0 X45.000 F30000\n M900 K0.000\n G0 X45.000 F30000\n G0 Y12.000 F30000\n G1 F1500.000 E0.800\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 F1500.000 E-0.800\n G1 X183 Z0.15 F30000\n G1 X185\n G1 Z1.0\n G0 Y6.000 F30000 ; move y to clear pos\n G1 Z0.3\n\n G0 X45.000 F30000 ; move to start point\n\nM623 ; end of \"draw extrinsic para cali paint\"\n\nM1002 judge_flag extrude_cali_flag\nM622 J0\n G0 X231 Y1.5 F30000\n G0 X129 E14 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G0 X18 E15 F{outer_wall_volumetric_speed/(0.3*0.5) * 60}\nM623\n\nM104 S140\n\n\n;=========== laser and rgb calibration ===========\nM400\nM18 E\nM500 R\n\nM973 S3 P14\n\nG1 X120 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nT1100\nG1 X235.0 Y1.0 Z0.3 F18000.0;Move to first extrude line pos\nM400 P100\nM960 S1 P1\nM400 P100\nM973 S6 P0; use auto exposure for horizontal laser by xcam\nM960 S0 P0\n\nG1 X240.0 Y6.0 Z0.3 F18000.0;Move to vertical extrude line pos\nM960 S2 P1\nM400 P100\nM973 S6 P1; use auto exposure for vertical laser by xcam\nM960 S0 P0\n\n;=========== handeye calibration ======================\nM1002 judge_flag extrude_cali_flag\nM622 J1\n\n M973 S3 P1 ; camera start stream\n M400 P500\n M973 S1\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G0 F6000 X228.500 Y4.500 Z0.000\n M960 S0 P1\n M973 S1\n M400 P800\n M971 S6 P0\n M973 S2 P0\n M400 P500\n G0 Z0.000 F12000\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P200\n M971 S5 P1\n M973 S2 P1\n M400 P500\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P3\n G0 Z0.500 F12000\n M960 S0 P0\n M960 S2 P1\n G0 X228.5 Y11.0\n M400 P200\n M971 S5 P4\n M973 S2 P0\n M400 P500\n M960 S0 P0\n M960 S1 P1\n G0 X221.00 Y4.50\n M400 P500\n M971 S5 P2\n M963 S1\n M400 P1500\n M964\n T1100\n G1 Z3 F3000\n\n M400\n M500 ; save cali data\n\n M104 S{nozzle_temperature_initial_layer[initial_no_support_extruder]} ; rise nozzle temp now ,to reduce temp waiting time.\n\n T1100\n M400 P400\n M960 S0 P0\n G0 F30000.000 Y10.000 X65.000 Z0.000\n M400 P400\n M960 S1 P1\n M400 P50\n\n M969 S1 N3 A2000\n G0 F360.000 X181.000 Z0.000\n M980.3 A70.000 B{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60/4} C5.000 D{outer_wall_volumetric_speed/(1.75*1.75/4*3.14)*60} E5.000 F175.000 H1.000 I0.000 J0.010 K0.020\n M400 P100\n G0 F20000\n G0 Z1 ; rise nozzle up\n T1000 ; change to nozzle space\n G0 X45.000 Y4.000 F30000 ; move to test line pos\n M969 S0 ; turn off scanning\n M960 S0 P0\n\n\n G1 Z2 F20000\n T1000\n G0 X45.000 Y4.000 F30000 E0\n M109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\n G0 Z0.3\n G1 F1500.000 E3.600\n G1 X65.000 E2.4945 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X70.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X75.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X80.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X85.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X90.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X95.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X100.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X105.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X110.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X115.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X120.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X125.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X130.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X135.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n\n ; see if extrude cali success, if not ,use default value\n M1002 judge_last_extrude_cali_success\n M622 J0\n M400\n M900 K0.01 M{outer_wall_volumetric_speed/(1.75*1.75/4*3.14) *0.01}\n M623\n\n G1 X140.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X145.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X150.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X155.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X160.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X165.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X170.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X175.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X180.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X185.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X190.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X195.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X200.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X205.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X210.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X215.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n G1 X220.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) / 4 * 60}\n G1 X225.000 E0.6236 F{outer_wall_volumetric_speed/(0.3*1.0) * 60}\n M973 S4\n\nM623\n\n;========turn off light and wait extrude temperature =============\nM1002 gcode_claim_action : 0\nM973 S4 ; turn off scanner\nM400 ; wait all motion done before implement the emprical L parameters\n;M900 L500.0 ; Empirical parameters\nM109 S[nozzle_temperature_initial_layer]\nM960 S1 P0 ; turn off laser\nM960 S2 P0 ; turn off laser\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off big fan\nM106 P3 S0 ; turn off chamber fan\n\nM975 S1 ; turn on mech mode supression\nG90\nM83\nT1000\nG1 E{-retraction_length[initial_no_support_extruder]} F1800\nG1 X128.0 Y253.0 Z0.2 F24000.0;Move to start position\nG1 E{retraction_length[initial_no_support_extruder]} F1800\nM109 S{nozzle_temperature_initial_layer[initial_no_support_extruder]}\nG0 X253 E6.4 F{outer_wall_volumetric_speed/(0.3*0.6) * 60}\nG0 Y128 E6.4\nG0 X252.5\nG0 Y252.5 E6.4\nG0 X128 E6.4" } \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon.json b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon.json index d07b2f8e6..fea08f27e 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1 Carbon.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1 Carbon.json @@ -1,13 +1,12 @@ { "type": "machine_model", "name": "Bambu Lab X1 Carbon", + "nozzle_diameter": "0.4;0.2;0.6;0.8", "model_id": "BL-P001", "url": "http://www.bambulab.com/Parameters/printer_model/Bambu Lab X1 Carbon.json", - "nozzle_diameter": "0.4;0.2;0.6;0.8", "machine_tech": "FFF", "family": "BBL-3DP", "bed_model": "bbl-3dp-X1.stl", "bed_texture": "bbl-3dp-logo.svg", - "hotend_model": "bbl-3dp-hotend.stl", "default_materials": "Generic PLA Silk;Generic PLA;Bambu PLA Matte @BBL X1C;Bambu PLA Basic @BBL X1C;Bambu ABS @BBL X1C;Bambu PC @BBL X1C;Bambu Support W @BBL X1C;Bambu TPU 95A @BBL X1C;PolyTerra PLA @BBL X1C;PolyLite PLA @BBL X1C;" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/Bambu Lab X1.json b/resources/profiles/BBL/machine/Bambu Lab X1.json index bb36dcb72..22e29b15b 100644 --- a/resources/profiles/BBL/machine/Bambu Lab X1.json +++ b/resources/profiles/BBL/machine/Bambu Lab X1.json @@ -1,13 +1,12 @@ { "type": "machine_model", "name": "Bambu Lab X1", + "nozzle_diameter": "0.4;0.2;0.6;0.8", "model_id": "BL-P002", "url": "http://www.bambulab.com/Parameters/printer_model/Bambu Lab X1.json", - "nozzle_diameter": "0.4;0.2;0.6;0.8", "machine_tech": "FFF", "family": "BBL-3DP", "bed_model": "bbl-3dp-X1.stl", "bed_texture": "bbl-3dp-logo.svg", - "hotend_model": "bbl-3dp-hotend.stl", "default_materials": "Generic PLA Silk;Generic PLA;Bambu PLA Matte @BBL X1;Bambu PLA Basic @BBL X1;Bambu ABS @BBL X1C;Bambu PC @BBL X1C;Bambu Support W @BBL X1;Bambu TPU 95A @BBL X1;PolyTerra PLA @BBL X1;PolyLite PLA @BBL X1;" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json b/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json index 4abdcc61e..b6a6529e1 100644 --- a/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json +++ b/resources/profiles/BBL/machine/fdm_bbl_3dp_001_common.json @@ -1,8 +1,13 @@ { "type": "machine", "name": "fdm_bbl_3dp_001_common", + "inherits": "fdm_machine_common", "from": "system", "instantiation": "false", + "nozzle_diameter": [ + "0.4" + ], + "printer_variant": "0.4", "printable_area": [ "0x0", "256x0", @@ -27,11 +32,6 @@ "extruder_colour": [ "#018001" ], - "extruder_offset": [ - "0x0" - ], - "gcode_flavor": "marlin", - "inherits": "fdm_machine_common", "machine_max_acceleration_e": [ "5000", "5000" @@ -45,8 +45,8 @@ "5000" ], "machine_max_acceleration_travel": [ - "20000", - "20000" + "9000", + "9000" ], "machine_max_acceleration_x": [ "20000", @@ -100,33 +100,21 @@ "0", "0" ], - "max_layer_height": [ - "0.32" + "retract_lift_below":[ + "249" ], - "min_layer_height": [ - "0.08" - ], - "printable_height": "250", "extruder_clearance_radius": "57", "extruder_clearance_max_radius": "68", - "extruder_clearance_height_to_rod": "36", "extruder_clearance_height_to_lid": "90", "nozzle_volume": "107", - "nozzle_diameter": [ - "0.4" - ], - "printer_settings_id": "", - "printer_technology": "FFF", - "printer_variant": "0.4", + "printer_structure": "corexy", + "best_object_pos":"0.5x0.5", "retraction_minimum_travel": [ "1" ], "retract_before_wipe": [ "0%" ], - "retract_when_changing_layer": [ - "1" - ], "retraction_length": [ "0.8" ], @@ -136,12 +124,6 @@ "z_hop": [ "0.4" ], - "retract_restart_extra": [ - "0" - ], - "retract_restart_extra_toolchange": [ - "0" - ], "retraction_speed": [ "30" ], @@ -149,18 +131,14 @@ "30" ], "z_hop_types": [ - "Auto Lift" + "Auto Lift" ], "nozzle_type": "hardened_steel", - "silent_mode": "0", "single_extruder_multi_material": "1", - "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n\nG92 E0\n{if flush_length_1 > 1}\n; FLUSH_START\n; always use highest temperature to flush\nM400\nM109 S[nozzle_temperature_range_high]\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A", - "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n{if timelapse_type == 0} ; timelapse without wipe tower\nM971 S11 C10 O0\n{elsif timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 X65 Y245 F20000 ; move to safe pos\nG17\nG2 Z{layer_z} I0.86 J0.86 P1 F20000\nG1 Y265 F3000\nM400 P300\nM971 S11 C10 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255 F20000\n{endif}\nM623\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change", "machine_end_gcode": ";===== date: 20230428 =====================\nM400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-0.8 F1800 ; retract\nG1 Z{max_layer_z + 0.5} F900 ; lower z a little\nG1 X65 Y245 F12000 ; move to safe pos \nG1 Y265 F3000\n\nG1 X65 Y245 F12000\nG1 Y265 F3000\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nM106 P2 S0 ; turn off remote part cooling fan\nM106 P3 S0 ; turn off chamber cooling fan\n\nG1 X100 F12000 ; wipe\n; pull back filament to AMS\nM620 S255\nG1 X20 Y50 F12000\nG1 Y-3\nT255\nG1 X65 F12000\nG1 Y265\nG1 X100 F12000 ; wipe\nM621 S255\nM104 S0 ; turn off hotend\n\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n M400 ; wait all motion done\n M991 S0 P-1 ;end smooth timelapse at safe pos\n M400 S3 ;wait for last picture to be taken\nM623; end of \"timelapse_record_flag\"\n\nM400 ; wait all motion done\nM17 S\nM17 Z0.4 ; lower z motor current to reduce impact if there is something in the bottom\n{if (max_layer_z + 100.0) < 250}\n G1 Z{max_layer_z + 100.0} F600\n G1 Z{max_layer_z +98.0}\n{else}\n G1 Z250 F600\n G1 Z248\n{endif}\nM400 P100\nM17 R ; restore z current\n\nG90\nG1 X128 Y250 F3600\n\nM220 S100 ; Reset feedrate magnitude\nM201.2 K1.0 ; Reset acc magnitude\nM73.2 R1.0 ;Reset left time magnitude\nM1002 set_gcode_claim_speed_level : 0\n\nM17 X0.8 Y0.8 Z0.5 ; lower motor current to 45% power\n", + "layer_change_gcode": "; layer num/total_layer_count: {layer_num+1}/[total_layer_count]\nM622.1 S1 ; for prev firware, default turned on\nM1002 judge_flag timelapse_record_flag\nM622 J1\n{if timelapse_type == 0} ; timelapse without wipe tower\nM971 S11 C10 O0\n{elsif timelapse_type == 1} ; timelapse with wipe tower\nG92 E0\nG1 E-[retraction_length] F1800\nG17\nG2 Z{layer_z + 0.4} I0.86 J0.86 P1 F20000 ; spiral lift a little\nG1 X65 Y245 F20000 ; move to safe pos\nG17\nG2 Z{layer_z} I0.86 J0.86 P1 F20000\nG1 Y265 F3000\nM400 P300\nM971 S11 C10 O0\nG92 E0\nG1 E[retraction_length] F300\nG1 X100 F5000\nG1 Y255 F20000\n{endif}\nM623\n; update layer progress\nM73 L{layer_num+1}\nM991 S0 P{layer_num} ;notify layer change", + "change_filament_gcode": "M620 S[next_extruder]A\nM204 S9000\n{if toolchange_count > 1 && (z_hop_types[current_extruder] == 0 || z_hop_types[current_extruder] == 3)}\nG17\nG2 Z{z_after_toolchange + 0.4} I0.86 J0.86 P1 F10000 ; spiral lift a little from second lift\n{endif}\nG1 Z{max_layer_z + 3.0} F1200\n\nG1 X70 F21000\nG1 Y245\nG1 Y265 F3000\nM400\nM106 P1 S0\nM106 P2 S0\n{if old_filament_temp > 142 && next_extruder < 255}\nM104 S[old_filament_temp]\n{endif}\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 X120 F15000\n\nG1 X20 Y50 F21000\nG1 Y-3\n{if toolchange_count == 2}\n; get travel path for change filament\nM620.1 X[travel_point_1_x] Y[travel_point_1_y] F21000 P0\nM620.1 X[travel_point_2_x] Y[travel_point_2_y] F21000 P1\nM620.1 X[travel_point_3_x] Y[travel_point_3_y] F21000 P2\n{endif}\nM620.1 E F[old_filament_e_feedrate] T{nozzle_temperature_range_high[previous_extruder]}\nT[next_extruder]\nM620.1 E F[new_filament_e_feedrate] T{nozzle_temperature_range_high[next_extruder]}\n\n{if next_extruder < 255}\nM400\n\nG92 E0\n{if flush_length_1 > 1}\n; FLUSH_START\n; always use highest temperature to flush\nM400\nM109 S[nozzle_temperature_range_high]\n{if flush_length_1 > 23.7}\nG1 E23.7 F{old_filament_e_feedrate} ; do not need pulsatile flushing for start part\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{old_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\nG1 E{(flush_length_1 - 23.7) * 0.02} F50\nG1 E{(flush_length_1 - 23.7) * 0.23} F{new_filament_e_feedrate}\n{else}\nG1 E{flush_length_1} F{old_filament_e_feedrate}\n{endif}\n; FLUSH_END\nG1 E-[old_retract_length_toolchange] F1800\nG1 E[old_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_2 > 1}\n; FLUSH_START\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\nG1 E{flush_length_2 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_2 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_3 > 1}\n; FLUSH_START\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\nG1 E{flush_length_3 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_3 * 0.02} F50\n; FLUSH_END\nG1 E-[new_retract_length_toolchange] F1800\nG1 E[new_retract_length_toolchange] F300\n{endif}\n\n{if flush_length_4 > 1}\n; FLUSH_START\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\nG1 E{flush_length_4 * 0.18} F{new_filament_e_feedrate}\nG1 E{flush_length_4 * 0.02} F50\n; FLUSH_END\n{endif}\n; FLUSH_START\nM400\nM109 S[new_filament_temp]\nG1 E2 F{new_filament_e_feedrate} ;Compensate for filament spillage during waiting temperature\n; FLUSH_END\nM400\nG92 E0\nG1 E-[new_retract_length_toolchange] F1800\nM106 P1 S255\nM400 S3\nG1 X80 F15000\nG1 X60 F15000\nG1 X80 F15000\nG1 X60 F15000; shake to put down garbage\n\nG1 X70 F5000\nG1 X90 F3000\nG1 Y255 F4000\nG1 X100 F5000\nG1 Y265 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X70 F10000\nG1 X100 F5000\nG1 X165 F15000; wipe and shake\nG1 Y256 ; move Y to aside, prevent collision\nM400\nG1 Z{max_layer_z + 3.0} F3000\n{if layer_z <= (initial_layer_print_height + 0.001)}\nM204 S[initial_layer_acceleration]\n{else}\nM204 S[default_acceleration]\n{endif}\n{else}\nG1 X[x_after_toolchange] Y[y_after_toolchange] Z[z_after_toolchange] F12000\n{endif}\nM621 S[next_extruder]A", "machine_pause_gcode": "M400 U1", - "wipe": [ - "1" - ], - "purge_in_prime_tower": "0", + purge_in_prime_tower": "0", "enable_filament_ramming": "0" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/machine/fdm_machine_common.json b/resources/profiles/BBL/machine/fdm_machine_common.json index 4fb2bb4a0..c161bc9a8 100644 --- a/resources/profiles/BBL/machine/fdm_machine_common.json +++ b/resources/profiles/BBL/machine/fdm_machine_common.json @@ -3,6 +3,11 @@ "name": "fdm_machine_common", "from": "system", "instantiation": "false", + "nozzle_diameter": [ + "0.4" + ], + "printer_variant": "0.4", + "support_chamber_temp_control": "0", "printer_technology": "FFF", "deretraction_speed": [ "40" @@ -73,11 +78,7 @@ "extruder_clearance_radius": "65", "extruder_clearance_height_to_rod": "36", "extruder_clearance_height_to_lid": "140", - "nozzle_diameter": [ - "0.4" - ], "printer_settings_id": "", - "printer_variant": "0.4", "retraction_minimum_travel": [ "2" ], @@ -106,13 +107,14 @@ "60" ], "single_extruder_multi_material": "0", - "change_filament_gcode": "", + "support_air_filtration": "0", "wipe": [ "1" ], - "default_filament_profile":[], + "default_filament_profile": [], "default_print_profile": "0.16mm Optimal @BBL X1C", "upward_compatible_machine": [], "machine_start_gcode": "G0 Z20 F9000\nG92 E0; G1 E-10 F1200\nG28\nM970 Q1 A10 B10 C130 K0\nM970 Q1 A10 B131 C250 K1\nM974 Q1 S1 P0\nM970 Q0 A10 B10 C130 H20 K0\nM970 Q0 A10 B131 C250 K1\nM974 Q0 S1 P0\nM220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\nG29 ;Home\nG90;\nG92 E0 ;Reset Extruder \nG1 Z2.0 F3000 ;Move Z Axis up \nG1 X10.1 Y20 Z0.28 F5000.0 ;Move to start position\nM109 S205;\nG1 X10.1 Y200.0 Z0.28 F1500.0 E15 ;Draw the first line\nG1 X10.4 Y200.0 Z0.28 F5000.0 ;Move to side a little\nG1 X10.4 Y20 Z0.28 F1500.0 E30 ;Draw the second line\nG92 E0 ;Reset Extruder \nG1 X110 Y110 Z2.0 F3000 ;Move Z Axis up", - "machine_end_gcode": "M400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-4.0 F3600; retract \nG91\nG1 Z3;\nM104 S0 ; turn off hotend\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nG90 \nG0 X110 Y200 F3600 \nprint_end" -} + "machine_end_gcode": "M400 ; wait for buffer to clear\nG92 E0 ; zero the extruder\nG1 E-4.0 F3600; retract \nG91\nG1 Z3;\nM104 S0 ; turn off hotend\nM140 S0 ; turn off bed\nM106 S0 ; turn off fan\nG90 \nG0 X110 Y200 F3600 \nprint_end", + "change_filament_gcode": "" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.06mm Fine @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm Fine @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..fb6886c4b --- /dev/null +++ b/resources/profiles/BBL/process/0.06mm Fine @BBL A1M 0.2 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.06mm Fine @BBL A1M 0.2 nozzle", + "inherits": "fdm_process_bbl_0.06_nozzle_0.2", + "from": "system", + "setting_id": "GP050", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json index 7ae6dfbb5..f2af60320 100644 --- a/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.06mm Standard @BBL X1C 0.2 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP024", "name": "0.06mm Standard @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.06_nozzle_0.2", + "from": "system", + "setting_id": "GP024", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1M.json b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1M.json new file mode 100644 index 000000000..e9698adc2 --- /dev/null +++ b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.08mm Extra Fine @BBL A1M", + "inherits": "fdm_process_bbl_0.08", + "from": "system", + "setting_id": "GP049", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json index 1ad3ee777..bc9f93e28 100644 --- a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json +++ b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL P1P.json @@ -1,12 +1,11 @@ { "type": "process", - "setting_id": "GP018", "name": "0.08mm Extra Fine @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.08", + "from": "system", + "setting_id": "GP018", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json index 008fc25ec..1742e8dc4 100644 --- a/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json +++ b/resources/profiles/BBL/process/0.08mm Extra Fine @BBL X1C.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP001", "name": "0.08mm Extra Fine @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.08", + "from": "system", + "setting_id": "GP001", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.08mm Optimal @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm Optimal @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..85fcb8822 --- /dev/null +++ b/resources/profiles/BBL/process/0.08mm Optimal @BBL A1M 0.2 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.08mm Optimal @BBL A1M 0.2 nozzle", + "inherits": "fdm_process_bbl_0.08_nozzle_0.2", + "from": "system", + "setting_id": "GP051", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json index 3d1f61e17..9c87571fe 100644 --- a/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.08mm Standard @BBL X1C 0.2 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP025", "name": "0.08mm Standard @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.08_nozzle_0.2", + "from": "system", + "setting_id": "GP025", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.10mm Standard @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm Standard @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..53895d550 --- /dev/null +++ b/resources/profiles/BBL/process/0.10mm Standard @BBL A1M 0.2 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.10mm Standard @BBL A1M 0.2 nozzle", + "inherits": "0.10mm Standard @BBL P1P 0.2 nozzle", + "from": "system", + "setting_id": "GP039", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json index 4a07e92e5..0b50342c1 100644 --- a/resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm Standard @BBL P1P 0.2 nozzle.json @@ -1,13 +1,12 @@ { "type": "process", - "setting_id": "GP014", "name": "0.10mm Standard @BBL P1P 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.10_nozzle_0.2", + "from": "system", + "setting_id": "GP014", + "instantiation": "true", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json index 9799b3e0c..d699cb76c 100644 --- a/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.10mm Standard @BBL X1C 0.2 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP007", "name": "0.10mm Standard @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.10_nozzle_0.2", + "from": "system", + "setting_id": "GP007", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.12mm Draft @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.12mm Draft @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..095aa8715 --- /dev/null +++ b/resources/profiles/BBL/process/0.12mm Draft @BBL A1M 0.2 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.12mm Draft @BBL A1M 0.2 nozzle", + "inherits": "fdm_process_bbl_0.12_nozzle_0.2", + "from": "system", + "setting_id": "GP052", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.12mm Fine @BBL A1M.json b/resources/profiles/BBL/process/0.12mm Fine @BBL A1M.json new file mode 100644 index 000000000..13f587e1b --- /dev/null +++ b/resources/profiles/BBL/process/0.12mm Fine @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.12mm Fine @BBL A1M", + "inherits": "fdm_process_bbl_0.12", + "from": "system", + "setting_id": "GP044", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json b/resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json index c4a4161e4..03afc8bee 100644 --- a/resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json +++ b/resources/profiles/BBL/process/0.12mm Fine @BBL P1P.json @@ -1,12 +1,11 @@ { "type": "process", - "setting_id": "GP019", "name": "0.12mm Fine @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.12", + "from": "system", + "setting_id": "GP019", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json b/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json index 33e27772d..ecfd6a45e 100644 --- a/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json +++ b/resources/profiles/BBL/process/0.12mm Fine @BBL X1C.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP002", "name": "0.12mm Fine @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.12", + "from": "system", + "setting_id": "GP002", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json index feec90196..63e4db5ee 100644 --- a/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.12mm Standard @BBL X1C 0.2 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP026", "name": "0.12mm Standard @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.12_nozzle_0.2", + "from": "system", + "setting_id": "GP026", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1M 0.2 nozzle.json b/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1M 0.2 nozzle.json new file mode 100644 index 000000000..3462b6ad1 --- /dev/null +++ b/resources/profiles/BBL/process/0.14mm Extra Draft @BBL A1M 0.2 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.14mm Extra Draft @BBL A1M 0.2 nozzle", + "inherits": "fdm_process_bbl_0.14_nozzle_0.2", + "from": "system", + "setting_id": "GP053", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.2 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json b/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json index 22507d0bf..cc737b50b 100644 --- a/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json +++ b/resources/profiles/BBL/process/0.14mm Standard @BBL X1C 0.2 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP027", "name": "0.14mm Standard @BBL X1C 0.2 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.14_nozzle_0.2", + "from": "system", + "setting_id": "GP027", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.2 nozzle", "Bambu Lab X1 0.2 nozzle", "Bambu Lab P1S 0.2 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.16mm Optimal @BBL A1M.json b/resources/profiles/BBL/process/0.16mm Optimal @BBL A1M.json new file mode 100644 index 000000000..7e7d9ca25 --- /dev/null +++ b/resources/profiles/BBL/process/0.16mm Optimal @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.16mm Optimal @BBL A1M", + "inherits": "fdm_process_bbl_0.16", + "from": "system", + "setting_id": "GP045", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json b/resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json index 0a852f354..1e0462da7 100644 --- a/resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json +++ b/resources/profiles/BBL/process/0.16mm Optimal @BBL P1P.json @@ -1,12 +1,11 @@ { "type": "process", - "setting_id": "GP020", "name": "0.16mm Optimal @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.16", + "from": "system", + "setting_id": "GP020", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json b/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json index 9eb280e8e..6f98d9b8c 100644 --- a/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json +++ b/resources/profiles/BBL/process/0.16mm Optimal @BBL X1C.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP003", "name": "0.16mm Optimal @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.16", + "from": "system", + "setting_id": "GP003", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.18mm Fine @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.18mm Fine @BBL A1M 0.6 nozzle.json new file mode 100644 index 000000000..7bc6534c7 --- /dev/null +++ b/resources/profiles/BBL/process/0.18mm Fine @BBL A1M 0.6 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.18mm Fine @BBL A1M 0.6 nozzle", + "inherits": "fdm_process_bbl_0.18_nozzle_0.6", + "from": "system", + "setting_id": "GP062", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json index dc15da6ce..c2ffcfa7d 100644 --- a/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.18mm Standard @BBL X1C 0.6 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP028", "name": "0.18mm Standard @BBL X1C 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.18_nozzle_0.6", + "from": "system", + "setting_id": "GP028", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.20mm Bambu Support W @BBL X1C.json b/resources/profiles/BBL/process/0.20mm Bambu Support W @BBL X1C.json index 2be87d861..dbe514443 100644 --- a/resources/profiles/BBL/process/0.20mm Bambu Support W @BBL X1C.json +++ b/resources/profiles/BBL/process/0.20mm Bambu Support W @BBL X1C.json @@ -16,6 +16,7 @@ "enable_prime_tower": "1", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", - "Bambu Lab X1 0.4 nozzle" + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab P1S 0.4 nozzle" ] } diff --git a/resources/profiles/BBL/process/0.20mm Standard @BBL A1M.json b/resources/profiles/BBL/process/0.20mm Standard @BBL A1M.json new file mode 100644 index 000000000..c168acda4 --- /dev/null +++ b/resources/profiles/BBL/process/0.20mm Standard @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.20mm Standard @BBL A1M", + "inherits": "0.20mm Standard @BBL P1P", + "from": "system", + "setting_id": "GP000", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json b/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json index 9ddd1a62f..1b60746ef 100644 --- a/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json +++ b/resources/profiles/BBL/process/0.20mm Standard @BBL P1P.json @@ -1,13 +1,11 @@ { "type": "process", - "setting_id": "GP015", "name": "0.20mm Standard @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.20", - "elefant_foot_compensation": "0.15", + "from": "system", + "setting_id": "GP015", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json b/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json index b66bc40f7..8ac7f03d8 100644 --- a/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json +++ b/resources/profiles/BBL/process/0.20mm Standard @BBL X1C.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP004", "name": "0.20mm Standard @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.20", + "from": "system", + "setting_id": "GP004", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.20mm Strength @BBL A1M.json b/resources/profiles/BBL/process/0.20mm Strength @BBL A1M.json new file mode 100644 index 000000000..839948ef6 --- /dev/null +++ b/resources/profiles/BBL/process/0.20mm Strength @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.20mm Strength @BBL A1M", + "inherits": "0.20mm Strength @BBL P1P", + "from": "system", + "setting_id": "GP046", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json b/resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json index e720fd294..c38f5f711 100644 --- a/resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json +++ b/resources/profiles/BBL/process/0.20mm Strength @BBL P1P.json @@ -1,15 +1,14 @@ { "type": "process", - "setting_id": "GP021", "name": "0.20mm Strength @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.20", + "from": "system", + "setting_id": "GP021", + "instantiation": "true", "outer_wall_speed": "60", - "wall_loops": "6", "sparse_infill_density": "25%", + "wall_loops": "6", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json b/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json index c664f379c..06af7e79e 100644 --- a/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json +++ b/resources/profiles/BBL/process/0.20mm Strength @BBL X1C.json @@ -1,10 +1,10 @@ { "type": "process", - "setting_id": "GP013", "name": "0.20mm Strength @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.20", + "from": "system", + "setting_id": "GP013", + "instantiation": "true", "outer_wall_speed": "60", "wall_loops": "6", "sparse_infill_density": "25%", @@ -12,6 +12,5 @@ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.24mm Draft @BBL A1M.json b/resources/profiles/BBL/process/0.24mm Draft @BBL A1M.json new file mode 100644 index 000000000..1b8d37324 --- /dev/null +++ b/resources/profiles/BBL/process/0.24mm Draft @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.24mm Draft @BBL A1M", + "inherits": "fdm_process_bbl_0.24", + "from": "system", + "setting_id": "GP047", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json b/resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json index 72d466576..87866d4f7 100644 --- a/resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json +++ b/resources/profiles/BBL/process/0.24mm Draft @BBL P1P.json @@ -1,12 +1,11 @@ { "type": "process", - "setting_id": "GP022", "name": "0.24mm Draft @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.24", + "from": "system", + "setting_id": "GP022", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json b/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json index 5a06e7d29..204262d78 100644 --- a/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json +++ b/resources/profiles/BBL/process/0.24mm Draft @BBL X1C.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP005", "name": "0.24mm Draft @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.24", + "from": "system", + "setting_id": "GP005", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.24mm Fine @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.24mm Fine @BBL A1M 0.8 nozzle.json new file mode 100644 index 000000000..8a542171d --- /dev/null +++ b/resources/profiles/BBL/process/0.24mm Fine @BBL A1M 0.8 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.24mm Fine @BBL A1M 0.8 nozzle", + "inherits": "fdm_process_bbl_0.24_nozzle_0.8", + "from": "system", + "setting_id": "GP057", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.24mm Optimal @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.24mm Optimal @BBL A1M 0.6 nozzle.json new file mode 100644 index 000000000..e5eaf7207 --- /dev/null +++ b/resources/profiles/BBL/process/0.24mm Optimal @BBL A1M 0.6 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.24mm Optimal @BBL A1M 0.6 nozzle", + "inherits": "fdm_process_bbl_0.24_nozzle_0.6", + "from": "system", + "setting_id": "GP054", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json index d6b7d3604..c162ab88e 100644 --- a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.6 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP029", "name": "0.24mm Standard @BBL X1C 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.24_nozzle_0.6", + "from": "system", + "setting_id": "GP029", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json index c5873b75c..fa77ea78f 100644 --- a/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.24mm Standard @BBL X1C 0.8 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP032", "name": "0.24mm Standard @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.24_nozzle_0.8", + "from": "system", + "setting_id": "GP032", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1M.json b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1M.json new file mode 100644 index 000000000..4c19dcd43 --- /dev/null +++ b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL A1M.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.28mm Extra Draft @BBL A1M", + "inherits": "fdm_process_bbl_0.28", + "from": "system", + "setting_id": "GP048", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json index 5952a90ce..ca64d1e31 100644 --- a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json +++ b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL P1P.json @@ -1,12 +1,11 @@ { "type": "process", - "setting_id": "GP023", "name": "0.28mm Extra Draft @BBL P1P", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.28", + "from": "system", + "setting_id": "GP023", + "instantiation": "true", "compatible_printers": [ "Bambu Lab P1P 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json index 2311e5ef8..eb00aab2a 100644 --- a/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json +++ b/resources/profiles/BBL/process/0.28mm Extra Draft @BBL X1C.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP006", "name": "0.28mm Extra Draft @BBL X1C", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.28", + "from": "system", + "setting_id": "GP006", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.4 nozzle", "Bambu Lab X1 0.4 nozzle", "Bambu Lab P1S 0.4 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL A1M 0.6 nozzle.json new file mode 100644 index 000000000..960ad6d6c --- /dev/null +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL A1M 0.6 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.30mm Standard @BBL A1M 0.6 nozzle", + "inherits": "0.30mm Standard @BBL P1P 0.6 nozzle", + "from": "system", + "setting_id": "GP038", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json index 98be0e0b4..37b7593e8 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL P1P 0.6 nozzle.json @@ -1,13 +1,12 @@ { "type": "process", - "setting_id": "GP016", "name": "0.30mm Standard @BBL P1P 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.30_nozzle_0.6", + "from": "system", + "setting_id": "GP016", + "instantiation": "true", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json index f28703713..d6114dfac 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL X1 0.6 nozzle.json @@ -1,12 +1,11 @@ { "type": "process", - "setting_id": "GP011", "name": "0.30mm Standard @BBL X1 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.30_nozzle_0.6", + "from": "system", + "setting_id": "GP011", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json index f4f8b46a6..3ce90daed 100644 --- a/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Standard @BBL X1C 0.6 nozzle.json @@ -1,13 +1,12 @@ { "type": "process", - "setting_id": "GP010", "name": "0.30mm Standard @BBL X1C 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.30_nozzle_0.6", + "from": "system", + "setting_id": "GP010", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.30mm Strength @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Strength @BBL A1M 0.6 nozzle.json new file mode 100644 index 000000000..5eac111e7 --- /dev/null +++ b/resources/profiles/BBL/process/0.30mm Strength @BBL A1M 0.6 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.30mm Strength @BBL A1M 0.6 nozzle", + "inherits": "fdm_process_bbl_0.30_nozzle_0.6", + "from": "system", + "setting_id": "GP061", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json index a629c5fa1..e61d98d21 100644 --- a/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.30mm Strength @BBL X1C 0.6 nozzle.json @@ -1,16 +1,15 @@ { "type": "process", - "setting_id": "GP036", "name": "0.30mm Strength @BBL X1C 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.30_nozzle_0.6", + "from": "system", + "setting_id": "GP036", + "instantiation": "true", "wall_loops": "4", "sparse_infill_density": "25%", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.32mm Optimal @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.32mm Optimal @BBL A1M 0.8 nozzle.json new file mode 100644 index 000000000..f793ab206 --- /dev/null +++ b/resources/profiles/BBL/process/0.32mm Optimal @BBL A1M 0.8 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.32mm Optimal @BBL A1M 0.8 nozzle", + "inherits": "fdm_process_bbl_0.32_nozzle_0.8", + "from": "system", + "setting_id": "GP058", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json index ae2077afc..9bc34fc8c 100644 --- a/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.32mm Standard @BBL X1C 0.8 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP033", "name": "0.32mm Standard @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.32_nozzle_0.8", + "from": "system", + "setting_id": "GP033", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.36mm Draft @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.36mm Draft @BBL A1M 0.6 nozzle.json new file mode 100644 index 000000000..4a40cfb3d --- /dev/null +++ b/resources/profiles/BBL/process/0.36mm Draft @BBL A1M 0.6 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.36mm Draft @BBL A1M 0.6 nozzle", + "inherits": "fdm_process_bbl_0.36_nozzle_0.6", + "from": "system", + "setting_id": "GP055", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json index 448777e86..4cded0e54 100644 --- a/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.36mm Standard @BBL X1C 0.6 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP030", "name": "0.36mm Standard @BBL X1C 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.36_nozzle_0.6", + "from": "system", + "setting_id": "GP030", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL A1M 0.8 nozzle.json new file mode 100644 index 000000000..9b23f80d0 --- /dev/null +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL A1M 0.8 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.40mm Standard @BBL A1M 0.8 nozzle", + "inherits": "0.40mm Standard @BBL P1P 0.8 nozzle", + "from": "system", + "setting_id": "GP037", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json index 26be8470b..547915d19 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL P1P 0.8 nozzle.json @@ -1,13 +1,12 @@ { "type": "process", - "setting_id": "GP017", "name": "0.40mm Standard @BBL P1P 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.40_nozzle_0.8", + "from": "system", + "setting_id": "GP017", + "instantiation": "true", "elefant_foot_compensation": "0.15", "compatible_printers": [ "Bambu Lab P1P 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json index af8fade4d..e9aa8d183 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL X1 0.8 nozzle.json @@ -1,12 +1,11 @@ { "type": "process", - "setting_id": "GP012", "name": "0.40mm Standard @BBL X1 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.40_nozzle_0.8", + "from": "system", + "setting_id": "GP012", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json index 2638d4d80..ac53792b5 100644 --- a/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.40mm Standard @BBL X1C 0.8 nozzle.json @@ -1,13 +1,12 @@ { "type": "process", - "setting_id": "GP009", "name": "0.40mm Standard @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.40_nozzle_0.8", + "from": "system", + "setting_id": "GP009", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1M 0.6 nozzle.json b/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1M 0.6 nozzle.json new file mode 100644 index 000000000..b29e070b8 --- /dev/null +++ b/resources/profiles/BBL/process/0.42mm Extra Draft @BBL A1M 0.6 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.42mm Extra Draft @BBL A1M 0.6 nozzle", + "inherits": "fdm_process_bbl_0.42_nozzle_0.6", + "from": "system", + "setting_id": "GP056", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.6 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json b/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json index 0d0cfb73f..f46d7d641 100644 --- a/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json +++ b/resources/profiles/BBL/process/0.42mm Standard @BBL X1C 0.6 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP031", "name": "0.42mm Standard @BBL X1C 0.6 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.42_nozzle_0.6", + "from": "system", + "setting_id": "GP031", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.6 nozzle", "Bambu Lab X1 0.6 nozzle", "Bambu Lab P1S 0.6 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.48mm Draft @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.48mm Draft @BBL A1M 0.8 nozzle.json new file mode 100644 index 000000000..29d78d74d --- /dev/null +++ b/resources/profiles/BBL/process/0.48mm Draft @BBL A1M 0.8 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.48mm Draft @BBL A1M 0.8 nozzle", + "inherits": "fdm_process_bbl_0.48_nozzle_0.8", + "from": "system", + "setting_id": "GP059", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json index bb77dbe00..a0cf1b836 100644 --- a/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.48mm Standard @BBL X1C 0.8 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP034", "name": "0.48mm Standard @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.48_nozzle_0.8", + "from": "system", + "setting_id": "GP034", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", - "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + "Bambu Lab P1S 0.6 nozzle" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1M 0.8 nozzle.json b/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1M 0.8 nozzle.json new file mode 100644 index 000000000..43895dd83 --- /dev/null +++ b/resources/profiles/BBL/process/0.56mm Extra Draft @BBL A1M 0.8 nozzle.json @@ -0,0 +1,13 @@ +{ + "type": "process", + "name": "0.56mm Extra Draft @BBL A1M 0.8 nozzle", + "inherits": "fdm_process_bbl_0.56_nozzle_0.8", + "from": "system", + "setting_id": "GP060", + "instantiation": "true", + "default_acceleration": "6000", + "travel_speed": "700", + "compatible_printers": [ + "Bambu Lab A1 mini 0.8 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json b/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json index 314fd2c80..45b1ef9d3 100644 --- a/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json +++ b/resources/profiles/BBL/process/0.56mm Standard @BBL X1C 0.8 nozzle.json @@ -1,14 +1,13 @@ { "type": "process", - "setting_id": "GP035", "name": "0.56mm Standard @BBL X1C 0.8 nozzle", - "from": "system", - "instantiation": "true", "inherits": "fdm_process_bbl_0.56_nozzle_0.8", + "from": "system", + "setting_id": "GP035", + "instantiation": "true", "compatible_printers": [ "Bambu Lab X1 Carbon 0.8 nozzle", "Bambu Lab X1 0.8 nozzle", "Bambu Lab P1S 0.8 nozzle" - ], - "version": "01.07.00.18" + ] } \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.06_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.06_nozzle_0.2.json index 35257823a..c01ea5498 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.06_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.06_nozzle_0.2.json @@ -1,25 +1,25 @@ { - "type": "process", - "name": "fdm_process_bbl_0.06_nozzle_0.2", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.06", - "initial_layer_print_height": "0.1", - "wall_loops": "4", - "bottom_shell_layers": "5", - "top_shell_layers": "7", - "bridge_flow": "1", - "line_width": "0.22", - "outer_wall_line_width": "0.22", - "initial_layer_line_width": "0.25", - "sparse_infill_line_width": "0.22", - "inner_wall_line_width": "0.22", - "internal_solid_infill_line_width": "0.22", - "support_line_width": "0.22", - "top_surface_line_width": "0.22", - "initial_layer_speed": "40", - "initial_layer_infill_speed": "70", - "sparse_infill_speed": "100", - "top_surface_speed": "150" -} + "type": "process", + "name": "fdm_process_bbl_0.06_nozzle_0.2", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.06", + "initial_layer_print_height": "0.1", + "wall_loops": "4", + "bottom_shell_layers": "5", + "top_shell_layers": "7", + "bridge_flow": "1", + "line_width": "0.22", + "outer_wall_line_width": "0.22", + "initial_layer_line_width": "0.25", + "sparse_infill_line_width": "0.22", + "inner_wall_line_width": "0.22", + "internal_solid_infill_line_width": "0.22", + "support_line_width": "0.22", + "top_surface_line_width": "0.22", + "initial_layer_speed": "40", + "initial_layer_infill_speed": "70", + "sparse_infill_speed": "100", + "top_surface_speed": "150" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.08.json b/resources/profiles/BBL/process/fdm_process_bbl_0.08.json index 0348c3342..836980d3f 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.08.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.08.json @@ -1,9 +1,9 @@ { "type": "process", "name": "fdm_process_bbl_0.08", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", "layer_height": "0.08", "elefant_foot_compensation": "0.15", "bottom_shell_layers": "7", @@ -16,11 +16,9 @@ "inner_wall_speed": "350", "sparse_infill_speed": "450", "internal_solid_infill_speed": "350", - "top_surface_speed": "200", "gap_infill_speed": "350", "overhang_1_4_speed": "60", "overhang_2_4_speed": "30", "overhang_3_4_speed": "10", - "overhang_4_4_speed": "10", "support_threshold_angle": "15" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.08_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.08_nozzle_0.2.json index 90fae2139..43a8b60f0 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.08_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.08_nozzle_0.2.json @@ -1,25 +1,25 @@ { - "type": "process", - "name": "fdm_process_bbl_0.08_nozzle_0.2", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.08", - "initial_layer_print_height": "0.1", - "wall_loops": "4", - "bottom_shell_layers": "5", - "top_shell_layers": "7", - "bridge_flow": "1", - "line_width": "0.22", - "outer_wall_line_width": "0.22", - "initial_layer_line_width": "0.25", - "sparse_infill_line_width": "0.22", - "inner_wall_line_width": "0.22", - "internal_solid_infill_line_width": "0.22", - "support_line_width": "0.22", - "top_surface_line_width": "0.22", - "initial_layer_speed": "40", - "initial_layer_infill_speed": "70", - "sparse_infill_speed": "100", - "top_surface_speed": "150" -} + "type": "process", + "name": "fdm_process_bbl_0.08_nozzle_0.2", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.08", + "initial_layer_print_height": "0.1", + "wall_loops": "4", + "bottom_shell_layers": "5", + "top_shell_layers": "7", + "bridge_flow": "1", + "line_width": "0.22", + "outer_wall_line_width": "0.22", + "initial_layer_line_width": "0.25", + "sparse_infill_line_width": "0.22", + "inner_wall_line_width": "0.22", + "internal_solid_infill_line_width": "0.22", + "support_line_width": "0.22", + "top_surface_line_width": "0.22", + "initial_layer_speed": "40", + "initial_layer_infill_speed": "70", + "sparse_infill_speed": "100", + "top_surface_speed": "150" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.10_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.10_nozzle_0.2.json index a53df8b5a..cc7d77395 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.10_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.10_nozzle_0.2.json @@ -1,9 +1,9 @@ { "type": "process", "name": "fdm_process_bbl_0.10_nozzle_0.2", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", "layer_height": "0.1", "initial_layer_print_height": "0.1", "wall_loops": "4", @@ -22,4 +22,4 @@ "initial_layer_infill_speed": "70", "sparse_infill_speed": "100", "top_surface_speed": "150" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.12.json b/resources/profiles/BBL/process/fdm_process_bbl_0.12.json index dcbb2f9a4..e76673b43 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.12.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.12.json @@ -1,9 +1,9 @@ { "type": "process", "name": "fdm_process_bbl_0.12", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", "layer_height": "0.12", "bottom_shell_layers": "5", "elefant_foot_compensation": "0.15", @@ -16,11 +16,9 @@ "inner_wall_speed": "350", "sparse_infill_speed": "430", "internal_solid_infill_speed": "350", - "top_surface_speed": "200", "gap_infill_speed": "350", "overhang_1_4_speed": "60", "overhang_2_4_speed": "30", "overhang_3_4_speed": "10", - "overhang_4_4_speed": "10", "support_threshold_angle": "20" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.12_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.12_nozzle_0.2.json index 8a76d4c7c..040df9f8a 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.12_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.12_nozzle_0.2.json @@ -1,25 +1,25 @@ { - "type": "process", - "name": "fdm_process_bbl_0.12_nozzle_0.2", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.12", - "initial_layer_print_height": "0.1", - "wall_loops": "4", - "bottom_shell_layers": "5", - "top_shell_layers": "7", - "bridge_flow": "1", - "line_width": "0.22", - "outer_wall_line_width": "0.22", - "initial_layer_line_width": "0.25", - "sparse_infill_line_width": "0.22", - "inner_wall_line_width": "0.22", - "internal_solid_infill_line_width": "0.22", - "support_line_width": "0.22", - "top_surface_line_width": "0.22", - "initial_layer_speed": "40", - "initial_layer_infill_speed": "70", - "sparse_infill_speed": "100", - "top_surface_speed": "150" -} + "type": "process", + "name": "fdm_process_bbl_0.12_nozzle_0.2", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.12", + "initial_layer_print_height": "0.1", + "wall_loops": "4", + "bottom_shell_layers": "5", + "top_shell_layers": "7", + "bridge_flow": "1", + "line_width": "0.22", + "outer_wall_line_width": "0.22", + "initial_layer_line_width": "0.25", + "sparse_infill_line_width": "0.22", + "inner_wall_line_width": "0.22", + "internal_solid_infill_line_width": "0.22", + "support_line_width": "0.22", + "top_surface_line_width": "0.22", + "initial_layer_speed": "40", + "initial_layer_infill_speed": "70", + "sparse_infill_speed": "100", + "top_surface_speed": "150" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.14_nozzle_0.2.json b/resources/profiles/BBL/process/fdm_process_bbl_0.14_nozzle_0.2.json index 81bd28b30..be12c21e1 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.14_nozzle_0.2.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.14_nozzle_0.2.json @@ -1,25 +1,25 @@ { - "type": "process", - "name": "fdm_process_bbl_0.14_nozzle_0.2", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.14", - "initial_layer_print_height": "0.1", - "wall_loops": "4", - "bottom_shell_layers": "5", - "top_shell_layers": "7", - "bridge_flow": "1", - "line_width": "0.22", - "outer_wall_line_width": "0.22", - "initial_layer_line_width": "0.25", - "sparse_infill_line_width": "0.22", - "inner_wall_line_width": "0.22", - "internal_solid_infill_line_width": "0.22", - "support_line_width": "0.22", - "top_surface_line_width": "0.22", - "initial_layer_speed": "40", - "initial_layer_infill_speed": "70", - "sparse_infill_speed": "100", - "top_surface_speed": "150" -} + "type": "process", + "name": "fdm_process_bbl_0.14_nozzle_0.2", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.14", + "initial_layer_print_height": "0.1", + "wall_loops": "4", + "bottom_shell_layers": "5", + "top_shell_layers": "7", + "bridge_flow": "1", + "line_width": "0.22", + "outer_wall_line_width": "0.22", + "initial_layer_line_width": "0.25", + "sparse_infill_line_width": "0.22", + "inner_wall_line_width": "0.22", + "internal_solid_infill_line_width": "0.22", + "support_line_width": "0.22", + "top_surface_line_width": "0.22", + "initial_layer_speed": "40", + "initial_layer_infill_speed": "70", + "sparse_infill_speed": "100", + "top_surface_speed": "150" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.16.json b/resources/profiles/BBL/process/fdm_process_bbl_0.16.json index 14186f717..3c435f422 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.16.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.16.json @@ -1,9 +1,9 @@ { "type": "process", "name": "fdm_process_bbl_0.16", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", "layer_height": "0.16", "elefant_foot_compensation": "0.15", "bottom_shell_layers": "4", @@ -16,11 +16,9 @@ "inner_wall_speed": "300", "sparse_infill_speed": "330", "internal_solid_infill_speed": "300", - "top_surface_speed": "200", "gap_infill_speed": "300", "overhang_1_4_speed": "60", "overhang_2_4_speed": "30", "overhang_3_4_speed": "10", - "overhang_4_4_speed": "10", "support_threshold_angle": "25" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.18_nozzle_0.6.json b/resources/profiles/BBL/process/fdm_process_bbl_0.18_nozzle_0.6.json index 1a9120fdb..3baf1fd45 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.18_nozzle_0.6.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.18_nozzle_0.6.json @@ -1,34 +1,24 @@ { - "type": "process", - "name": "fdm_process_bbl_0.18_nozzle_0.6", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.18", - "initial_layer_print_height": "0.3", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", - "bridge_flow": "1", - "line_width": "0.62", - "outer_wall_line_width": "0.62", - "initial_layer_line_width": "0.62", - "sparse_infill_line_width": "0.62", - "inner_wall_line_width": "0.62", - "internal_solid_infill_line_width": "0.62", - "support_line_width": "0.62", - "top_surface_line_width": "0.62", - "initial_layer_speed": "35", - "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", - "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", - "top_surface_speed": "150", - "gap_infill_speed": "50", - "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "15", - "overhang_4_4_speed": "10" -} + "type": "process", + "name": "fdm_process_bbl_0.18_nozzle_0.6", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.18", + "initial_layer_print_height": "0.3", + "bridge_flow": "1", + "line_width": "0.62", + "outer_wall_line_width": "0.62", + "initial_layer_line_width": "0.62", + "sparse_infill_line_width": "0.62", + "inner_wall_line_width": "0.62", + "internal_solid_infill_line_width": "0.62", + "support_line_width": "0.62", + "top_surface_line_width": "0.62", + "initial_layer_speed": "35", + "initial_layer_infill_speed": "55", + "sparse_infill_speed": "100", + "top_surface_speed": "150", + "bridge_speed": "30", + "overhang_3_4_speed": "15" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.20.json b/resources/profiles/BBL/process/fdm_process_bbl_0.20.json index 12fe82dd1..d48f4a29a 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.20.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.20.json @@ -1,13 +1,10 @@ { "type": "process", "name": "fdm_process_bbl_0.20", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.2", "elefant_foot_compensation": "0.15", - "bottom_shell_layers": "3", - "top_shell_layers": "3", "top_shell_thickness": "0.6", "bridge_flow": "1", "initial_layer_speed": "50", @@ -16,6 +13,5 @@ "inner_wall_speed": "300", "sparse_infill_speed": "270", "internal_solid_infill_speed": "250", - "top_surface_speed": "200", "gap_infill_speed": "250" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.24.json b/resources/profiles/BBL/process/fdm_process_bbl_0.24.json index 3b83ea159..02e7595c7 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.24.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.24.json @@ -1,14 +1,12 @@ { "type": "process", "name": "fdm_process_bbl_0.24", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", "layer_height": "0.24", "elefant_foot_compensation": "0.15", "top_surface_line_width": "0.45", - "bottom_shell_layers": "3", - "top_shell_layers": "3", "top_shell_thickness": "0.6", "bridge_flow": "1", "initial_layer_speed": "50", @@ -17,7 +15,6 @@ "inner_wall_speed": "230", "sparse_infill_speed": "230", "internal_solid_infill_speed": "230", - "top_surface_speed": "200", "gap_infill_speed": "230", "support_threshold_angle": "35" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.24_nozzle_0.6.json b/resources/profiles/BBL/process/fdm_process_bbl_0.24_nozzle_0.6.json index aec643962..514e31759 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.24_nozzle_0.6.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.24_nozzle_0.6.json @@ -1,34 +1,24 @@ { - "type": "process", - "name": "fdm_process_bbl_0.24_nozzle_0.6", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.24", - "initial_layer_print_height": "0.3", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", - "bridge_flow": "1", - "line_width": "0.62", - "outer_wall_line_width": "0.62", - "initial_layer_line_width": "0.62", - "sparse_infill_line_width": "0.62", - "inner_wall_line_width": "0.62", - "internal_solid_infill_line_width": "0.62", - "support_line_width": "0.62", - "top_surface_line_width": "0.62", - "initial_layer_speed": "35", - "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", - "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", - "top_surface_speed": "150", - "gap_infill_speed": "50", - "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "15", - "overhang_4_4_speed": "10" -} + "type": "process", + "name": "fdm_process_bbl_0.24_nozzle_0.6", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.24", + "initial_layer_print_height": "0.3", + "bridge_flow": "1", + "line_width": "0.62", + "outer_wall_line_width": "0.62", + "initial_layer_line_width": "0.62", + "sparse_infill_line_width": "0.62", + "inner_wall_line_width": "0.62", + "internal_solid_infill_line_width": "0.62", + "support_line_width": "0.62", + "top_surface_line_width": "0.62", + "initial_layer_speed": "35", + "initial_layer_infill_speed": "55", + "sparse_infill_speed": "100", + "top_surface_speed": "150", + "bridge_speed": "30", + "overhang_3_4_speed": "15" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.24_nozzle_0.8.json b/resources/profiles/BBL/process/fdm_process_bbl_0.24_nozzle_0.8.json index 9c1cbf202..5fedaf53d 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.24_nozzle_0.8.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.24_nozzle_0.8.json @@ -1,35 +1,26 @@ { - "type": "process", - "name": "fdm_process_bbl_0.24_nozzle_0.8", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.24", - "initial_layer_print_height": "0.4", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", - "bridge_flow": "1", - "line_width": "0.82", - "outer_wall_line_width": "0.82", - "initial_layer_line_width": "0.82", - "sparse_infill_line_width": "0.82", - "inner_wall_line_width": "0.82", - "internal_solid_infill_line_width": "0.82", - "support_line_width": "0.82", - "top_surface_line_width": "0.82", - "top_surface_pattern": "monotonic", - "initial_layer_speed": "35", - "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", - "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", - "top_surface_speed": "150", - "gap_infill_speed": "50", - "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" -} + "type": "process", + "name": "fdm_process_bbl_0.24_nozzle_0.8", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.24", + "initial_layer_print_height": "0.4", + "bridge_flow": "1", + "line_width": "0.82", + "outer_wall_line_width": "0.82", + "initial_layer_line_width": "0.82", + "sparse_infill_line_width": "0.82", + "inner_wall_line_width": "0.82", + "internal_solid_infill_line_width": "0.82", + "support_line_width": "0.82", + "top_surface_line_width": "0.82", + "top_surface_pattern": "monotonic", + "initial_layer_speed": "35", + "initial_layer_infill_speed": "55", + "sparse_infill_speed": "100", + "top_surface_speed": "150", + "bridge_speed": "30", + "overhang_3_4_speed": "25", + "overhang_4_4_speed": "5" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.28.json b/resources/profiles/BBL/process/fdm_process_bbl_0.28.json index 08f80a2ef..1c70a95b9 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.28.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.28.json @@ -1,14 +1,12 @@ { "type": "process", "name": "fdm_process_bbl_0.28", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", "layer_height": "0.28", "elefant_foot_compensation": "0.15", "top_surface_line_width": "0.45", - "bottom_shell_layers": "3", - "top_shell_layers": "3", "top_shell_thickness": "0.6", "bridge_flow": "1", "initial_layer_speed": "50", @@ -17,7 +15,6 @@ "inner_wall_speed": "200", "sparse_infill_speed": "200", "internal_solid_infill_speed": "200", - "top_surface_speed": "200", "gap_infill_speed": "200", "support_threshold_angle": "40" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.30_nozzle_0.6.json b/resources/profiles/BBL/process/fdm_process_bbl_0.30_nozzle_0.6.json index ed6ce6974..26b39f373 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.30_nozzle_0.6.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.30_nozzle_0.6.json @@ -1,14 +1,11 @@ { "type": "process", "name": "fdm_process_bbl_0.30_nozzle_0.6", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", "layer_height": "0.3", "initial_layer_print_height": "0.3", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", "bridge_flow": "1", "line_width": "0.62", "outer_wall_line_width": "0.62", @@ -20,15 +17,8 @@ "top_surface_line_width": "0.62", "initial_layer_speed": "35", "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", "top_surface_speed": "150", - "gap_infill_speed": "50", "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "15", - "overhang_4_4_speed": "10" -} + "overhang_3_4_speed": "15" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.32_nozzle_0.8.json b/resources/profiles/BBL/process/fdm_process_bbl_0.32_nozzle_0.8.json index d64d4b6f2..12320f79f 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.32_nozzle_0.8.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.32_nozzle_0.8.json @@ -1,35 +1,26 @@ { - "type": "process", - "name": "fdm_process_bbl_0.32_nozzle_0.8", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.32", - "initial_layer_print_height": "0.3", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", - "bridge_flow": "1", - "line_width": "0.82", - "outer_wall_line_width": "0.82", - "initial_layer_line_width": "0.82", - "sparse_infill_line_width": "0.82", - "inner_wall_line_width": "0.82", - "internal_solid_infill_line_width": "0.82", - "support_line_width": "0.82", - "top_surface_line_width": "0.82", - "top_surface_pattern": "monotonic", - "initial_layer_speed": "35", - "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", - "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", - "top_surface_speed": "150", - "gap_infill_speed": "50", - "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" -} + "type": "process", + "name": "fdm_process_bbl_0.32_nozzle_0.8", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.32", + "initial_layer_print_height": "0.3", + "bridge_flow": "1", + "line_width": "0.82", + "outer_wall_line_width": "0.82", + "initial_layer_line_width": "0.82", + "sparse_infill_line_width": "0.82", + "inner_wall_line_width": "0.82", + "internal_solid_infill_line_width": "0.82", + "support_line_width": "0.82", + "top_surface_line_width": "0.82", + "top_surface_pattern": "monotonic", + "initial_layer_speed": "35", + "initial_layer_infill_speed": "55", + "sparse_infill_speed": "100", + "top_surface_speed": "150", + "bridge_speed": "30", + "overhang_3_4_speed": "25", + "overhang_4_4_speed": "5" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.36_nozzle_0.6.json b/resources/profiles/BBL/process/fdm_process_bbl_0.36_nozzle_0.6.json index a8a8a1387..f94531fbe 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.36_nozzle_0.6.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.36_nozzle_0.6.json @@ -1,34 +1,24 @@ { - "type": "process", - "name": "fdm_process_bbl_0.36_nozzle_0.6", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.36", - "initial_layer_print_height": "0.3", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", - "bridge_flow": "1", - "line_width": "0.62", - "outer_wall_line_width": "0.62", - "initial_layer_line_width": "0.62", - "sparse_infill_line_width": "0.62", - "inner_wall_line_width": "0.62", - "internal_solid_infill_line_width": "0.62", - "support_line_width": "0.62", - "top_surface_line_width": "0.62", - "initial_layer_speed": "35", - "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", - "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", - "top_surface_speed": "150", - "gap_infill_speed": "50", - "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "15", - "overhang_4_4_speed": "10" -} + "type": "process", + "name": "fdm_process_bbl_0.36_nozzle_0.6", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.36", + "initial_layer_print_height": "0.3", + "bridge_flow": "1", + "line_width": "0.62", + "outer_wall_line_width": "0.62", + "initial_layer_line_width": "0.62", + "sparse_infill_line_width": "0.62", + "inner_wall_line_width": "0.62", + "internal_solid_infill_line_width": "0.62", + "support_line_width": "0.62", + "top_surface_line_width": "0.62", + "initial_layer_speed": "35", + "initial_layer_infill_speed": "55", + "sparse_infill_speed": "100", + "top_surface_speed": "150", + "bridge_speed": "30", + "overhang_3_4_speed": "15" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.40_nozzle_0.8.json b/resources/profiles/BBL/process/fdm_process_bbl_0.40_nozzle_0.8.json index 503a81b4d..3e0d8b147 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.40_nozzle_0.8.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.40_nozzle_0.8.json @@ -1,14 +1,11 @@ { "type": "process", "name": "fdm_process_bbl_0.40_nozzle_0.8", + "inherits": "fdm_process_bbl_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_bbl_common", "layer_height": "0.4", "initial_layer_print_height": "0.4", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", "bridge_flow": "1", "line_width": "0.82", "outer_wall_line_width": "0.82", @@ -21,15 +18,9 @@ "top_surface_pattern": "monotonic", "initial_layer_speed": "35", "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", "top_surface_speed": "150", - "gap_infill_speed": "50", "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", "overhang_3_4_speed": "25", "overhang_4_4_speed": "5" -} +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.42_nozzle_0.6.json b/resources/profiles/BBL/process/fdm_process_bbl_0.42_nozzle_0.6.json index 7d9309c1b..07120eef7 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.42_nozzle_0.6.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.42_nozzle_0.6.json @@ -1,34 +1,24 @@ { - "type": "process", - "name": "fdm_process_bbl_0.42_nozzle_0.6", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.42", - "initial_layer_print_height": "0.3", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", - "bridge_flow": "1", - "line_width": "0.62", - "outer_wall_line_width": "0.62", - "initial_layer_line_width": "0.62", - "sparse_infill_line_width": "0.62", - "inner_wall_line_width": "0.62", - "internal_solid_infill_line_width": "0.62", - "support_line_width": "0.62", - "top_surface_line_width": "0.62", - "initial_layer_speed": "35", - "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", - "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", - "top_surface_speed": "150", - "gap_infill_speed": "50", - "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "15", - "overhang_4_4_speed": "10" -} + "type": "process", + "name": "fdm_process_bbl_0.42_nozzle_0.6", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.42", + "initial_layer_print_height": "0.3", + "bridge_flow": "1", + "line_width": "0.62", + "outer_wall_line_width": "0.62", + "initial_layer_line_width": "0.62", + "sparse_infill_line_width": "0.62", + "inner_wall_line_width": "0.62", + "internal_solid_infill_line_width": "0.62", + "support_line_width": "0.62", + "top_surface_line_width": "0.62", + "initial_layer_speed": "35", + "initial_layer_infill_speed": "55", + "sparse_infill_speed": "100", + "top_surface_speed": "150", + "bridge_speed": "30", + "overhang_3_4_speed": "15" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.48_nozzle_0.8.json b/resources/profiles/BBL/process/fdm_process_bbl_0.48_nozzle_0.8.json index 87c7d6b04..3a77fbf00 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.48_nozzle_0.8.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.48_nozzle_0.8.json @@ -1,35 +1,26 @@ { - "type": "process", - "name": "fdm_process_bbl_0.48_nozzle_0.8", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.48", - "initial_layer_print_height": "0.4", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", - "bridge_flow": "1", - "line_width": "0.82", - "outer_wall_line_width": "0.82", - "initial_layer_line_width": "0.82", - "sparse_infill_line_width": "0.82", - "inner_wall_line_width": "0.82", - "internal_solid_infill_line_width": "0.82", - "support_line_width": "0.82", - "top_surface_line_width": "0.82", - "top_surface_pattern": "monotonic", - "initial_layer_speed": "35", - "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", - "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", - "top_surface_speed": "150", - "gap_infill_speed": "50", - "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" -} + "type": "process", + "name": "fdm_process_bbl_0.48_nozzle_0.8", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.48", + "initial_layer_print_height": "0.4", + "bridge_flow": "1", + "line_width": "0.82", + "outer_wall_line_width": "0.82", + "initial_layer_line_width": "0.82", + "sparse_infill_line_width": "0.82", + "inner_wall_line_width": "0.82", + "internal_solid_infill_line_width": "0.82", + "support_line_width": "0.82", + "top_surface_line_width": "0.82", + "top_surface_pattern": "monotonic", + "initial_layer_speed": "35", + "initial_layer_infill_speed": "55", + "sparse_infill_speed": "100", + "top_surface_speed": "150", + "bridge_speed": "30", + "overhang_3_4_speed": "25", + "overhang_4_4_speed": "5" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_0.56_nozzle_0.8.json b/resources/profiles/BBL/process/fdm_process_bbl_0.56_nozzle_0.8.json index 311925326..3970ac5ac 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_0.56_nozzle_0.8.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_0.56_nozzle_0.8.json @@ -1,35 +1,26 @@ { - "type": "process", - "name": "fdm_process_bbl_0.56_nozzle_0.8", - "from": "system", - "instantiation": "false", - "inherits": "fdm_process_bbl_common", - "layer_height": "0.56", - "initial_layer_print_height": "0.4", - "wall_loops": "2", - "bottom_shell_layers": "3", - "top_shell_layers": "3", - "bridge_flow": "1", - "line_width": "0.82", - "outer_wall_line_width": "0.82", - "initial_layer_line_width": "0.82", - "sparse_infill_line_width": "0.82", - "inner_wall_line_width": "0.82", - "internal_solid_infill_line_width": "0.82", - "support_line_width": "0.82", - "top_surface_line_width": "0.82", - "top_surface_pattern": "monotonic", - "initial_layer_speed": "35", - "initial_layer_infill_speed": "55", - "outer_wall_speed": "120", - "inner_wall_speed": "150", - "sparse_infill_speed": "100", - "internal_solid_infill_speed": "150", - "top_surface_speed": "150", - "gap_infill_speed": "50", - "bridge_speed": "30", - "overhang_1_4_speed": "0", - "overhang_2_4_speed": "50", - "overhang_3_4_speed": "25", - "overhang_4_4_speed": "5" -} + "type": "process", + "name": "fdm_process_bbl_0.56_nozzle_0.8", + "inherits": "fdm_process_bbl_common", + "from": "system", + "instantiation": "false", + "layer_height": "0.56", + "initial_layer_print_height": "0.4", + "bridge_flow": "1", + "line_width": "0.82", + "outer_wall_line_width": "0.82", + "initial_layer_line_width": "0.82", + "sparse_infill_line_width": "0.82", + "inner_wall_line_width": "0.82", + "internal_solid_infill_line_width": "0.82", + "support_line_width": "0.82", + "top_surface_line_width": "0.82", + "top_surface_pattern": "monotonic", + "initial_layer_speed": "35", + "initial_layer_infill_speed": "55", + "sparse_infill_speed": "100", + "top_surface_speed": "150", + "bridge_speed": "30", + "overhang_3_4_speed": "25", + "overhang_4_4_speed": "5" +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_bbl_common.json b/resources/profiles/BBL/process/fdm_process_bbl_common.json index 5cfd7e111..223e2e9eb 100644 --- a/resources/profiles/BBL/process/fdm_process_bbl_common.json +++ b/resources/profiles/BBL/process/fdm_process_bbl_common.json @@ -1,47 +1,28 @@ { "type": "process", "name": "fdm_process_bbl_common", + "inherits": "fdm_process_common", "from": "system", "instantiation": "false", - "inherits": "fdm_process_common", - "adaptive_layer_height": "0", - "reduce_crossing_wall": "0", "max_travel_detour_distance": "0", "bottom_surface_pattern": "monotonic", "bottom_shell_layers": "3", "bottom_shell_thickness": "0", - "bridge_flow": "0.95", "bridge_speed": "50", - "brim_width": "5", "brim_object_gap": "0.1", - "compatible_printers": [], "compatible_printers_condition": "", - "print_sequence": "by layer", - "default_acceleration": "10000", - "bridge_no_support": "0", "draft_shield": "disabled", "elefant_foot_compensation": "0", "enable_arc_fitting": "1", - "outer_wall_line_width": "0.42", - "outer_wall_speed": "120", "outer_wall_acceleration": "5000", - "inner_wall_acceleration": "5000", "wall_infill_order": "inner wall/outer wall/infill", "line_width": "0.42", - "infill_direction": "45", - "sparse_infill_density": "15%", - "sparse_infill_pattern": "grid", "internal_bridge_support_thickness": "0.8", "initial_layer_acceleration": "500", "initial_layer_line_width": "0.5", - "initial_layer_print_height": "0.2", "initial_layer_speed": "30", "gap_infill_speed": "50", - "infill_combination": "0", - "sparse_infill_line_width": "0.45", - "infill_wall_overlap": "15%", "sparse_infill_speed": "250", - "interface_shells": "0", "ironing_flow": "10%", "ironing_spacing": "0.15", "ironing_speed": "30", @@ -55,38 +36,22 @@ "overhang_3_4_speed": "30", "overhang_4_4_speed": "10", "only_one_wall_top": "1", - "inner_wall_line_width": "0.45", "inner_wall_speed": "150", - "wall_loops": "2", - "print_settings_id": "", - "raft_layers": "0", "seam_position": "aligned", - "skirt_distance": "2", "skirt_height": "1", "skirt_loops": "0", "minimum_sparse_infill_area": "15", "internal_solid_infill_line_width": "0.42", "internal_solid_infill_speed": "150", - "spiral_mode": "0", "initial_layer_infill_speed": "60", - "standby_temperature_delta": "-5", - "enable_support": "0", "resolution": "0.012", "support_type": "normal(auto)", "support_style": "default", - "support_on_build_plate_only": "0", "support_top_z_distance": "0.2", "support_bottom_z_distance": "0.2", - "support_filament": "0", - "support_line_width": "0.42", - "support_interface_loop_pattern": "0", - "support_interface_filament": "0", - "support_interface_top_layers": "2", "support_interface_bottom_layers": "2", "support_interface_spacing": "0.5", - "support_expansion": "0", - "support_interface_speed": "80", - "support_base_pattern": "default", + "support_expansion": "0", "support_base_pattern_spacing": "2.5", "support_speed": "150", "support_threshold_angle": "30", @@ -94,9 +59,7 @@ "tree_support_branch_diameter": "2", "tree_support_branch_angle": "45", "tree_support_wall_count": "1", - "detect_thin_wall": "0", "top_surface_pattern": "monotonicline", - "top_surface_line_width": "0.42", "top_surface_acceleration": "2000", "top_surface_speed": "200", "top_shell_layers": "3", @@ -105,9 +68,6 @@ "enable_prime_tower": "1", "wipe_tower_no_sparse_layers": "0", "prime_tower_width": "35", - "xy_hole_compensation": "0", - "xy_contour_compensation": "0", - "wall_generator": "arachne", - "gcode_label_objects": "0", - "flush_multiplier": "1.0" -} + "wall_generator": "classic", + "compatible_printers": [] +} \ No newline at end of file diff --git a/resources/profiles/BBL/process/fdm_process_common.json b/resources/profiles/BBL/process/fdm_process_common.json index 0177d23c6..921718b99 100644 --- a/resources/profiles/BBL/process/fdm_process_common.json +++ b/resources/profiles/BBL/process/fdm_process_common.json @@ -8,7 +8,6 @@ "bridge_flow": "0.95", "bridge_speed": "25", "brim_width": "5", - "compatible_printers": [], "print_sequence": "by layer", "default_acceleration": "10000", "bridge_no_support": "0", @@ -67,5 +66,6 @@ "enable_prime_tower": "0", "prime_tower_width": "60", "xy_hole_compensation": "0", - "xy_contour_compensation": "0" -} + "xy_contour_compensation": "0", + "compatible_printers": [] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic ABS @Tronxy.json b/resources/profiles/Tronxy/filament/Generic ABS @Tronxy.json new file mode 100644 index 000000000..e5769a0a6 --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic ABS @Tronxy.json @@ -0,0 +1,18 @@ +{ + "type": "filament", + "name": "Generic ABS @Tronxy", + "inherits": "fdm_filament_abs", + "from": "system", + "filament_id": "GFB99", + "setting_id": "GFSB99_Tronxy_00", + "instantiation": "true", + "filament_flow_ratio": [ + "0.926" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic ASA @Tronxy.json b/resources/profiles/Tronxy/filament/Generic ASA @Tronxy.json new file mode 100644 index 000000000..bcc6db086 --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic ASA @Tronxy.json @@ -0,0 +1,18 @@ +{ + "type": "filament", + "name": "Generic ASA @Tronxy", + "inherits": "fdm_filament_asa", + "from": "system", + "filament_id": "GFB98", + "setting_id": "GFSB98_Tronxy_00", + "instantiation": "true", + "filament_flow_ratio": [ + "0.93" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic PA @Tronxy.json b/resources/profiles/Tronxy/filament/Generic PA @Tronxy.json new file mode 100644 index 000000000..7dd36a14d --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic PA @Tronxy.json @@ -0,0 +1,21 @@ +{ + "type": "filament", + "name": "Generic PA @Tronxy", + "inherits": "fdm_filament_pa", + "from": "system", + "filament_id": "GFN99", + "setting_id": "GFSN99_Tronxy_00", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "12" + ], + "nozzle_temperature": [ + "280" + ], + "nozzle_temperature_initial_layer": [ + "280" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic PA-CF @Tronxy.json b/resources/profiles/Tronxy/filament/Generic PA-CF @Tronxy.json new file mode 100644 index 000000000..3039e8815 --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic PA-CF @Tronxy.json @@ -0,0 +1,21 @@ +{ + "type": "filament", + "name": "Generic PA-CF @Tronxy", + "inherits": "fdm_filament_pa", + "from": "system", + "filament_id": "GFN98", + "setting_id": "GFSN98_Tronxy_00", + "instantiation": "true", + "filament_type": [ + "PA-CF" + ], + "nozzle_temperature": [ + "280" + ], + "nozzle_temperature_initial_layer": [ + "280" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic PC @Tronxy.json b/resources/profiles/Tronxy/filament/Generic PC @Tronxy.json new file mode 100644 index 000000000..fdd7fbf3a --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic PC @Tronxy.json @@ -0,0 +1,18 @@ +{ + "type": "filament", + "name": "Generic PC @Tronxy", + "inherits": "fdm_filament_pc", + "from": "system", + "filament_id": "GFC99", + "setting_id": "GFSC99_Tronxy_00", + "instantiation": "true", + "filament_flow_ratio": [ + "0.94" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic PETG @Tronxy.json b/resources/profiles/Tronxy/filament/Generic PETG @Tronxy.json new file mode 100644 index 000000000..0ceb93ae2 --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic PETG @Tronxy.json @@ -0,0 +1,33 @@ +{ + "type": "filament", + "name": "Generic PETG @Tronxy", + "inherits": "fdm_filament_pet", + "from": "system", + "filament_id": "GFG99", + "setting_id": "GFSG99_Tronxy_00", + "instantiation": "true", + "fan_cooling_layer_time": [ + "30" + ], + "fan_max_speed": [ + "90" + ], + "fan_min_speed": [ + "40" + ], + "filament_flow_ratio": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "10" + ], + "overhang_fan_speed": [ + "90" + ], + "overhang_fan_threshold": [ + "25%" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic PLA @Tronxy.json b/resources/profiles/Tronxy/filament/Generic PLA @Tronxy.json new file mode 100644 index 000000000..de5bb2aa3 --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic PLA @Tronxy.json @@ -0,0 +1,18 @@ +{ + "type": "filament", + "name": "Generic PLA @Tronxy", + "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFL99", + "setting_id": "GFSL99_Tronxy_00", + "instantiation": "true", + "filament_flow_ratio": [ + "0.98" + ], + "slow_down_layer_time": [ + "8" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic PLA-CF @Tronxy.json b/resources/profiles/Tronxy/filament/Generic PLA-CF @Tronxy.json new file mode 100644 index 000000000..34f50c2f9 --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic PLA-CF @Tronxy.json @@ -0,0 +1,21 @@ +{ + "type": "filament", + "name": "Generic PLA-CF @Tronxy", + "inherits": "fdm_filament_pla", + "from": "system", + "filament_id": "GFL98", + "setting_id": "GFSL98_Tronxy_00", + "instantiation": "true", + "filament_flow_ratio": [ + "0.95" + ], + "filament_type": [ + "PLA-CF" + ], + "slow_down_layer_time": [ + "7" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic PVA @Tronxy.json b/resources/profiles/Tronxy/filament/Generic PVA @Tronxy.json new file mode 100644 index 000000000..75ccac1a5 --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic PVA @Tronxy.json @@ -0,0 +1,21 @@ +{ + "type": "filament", + "name": "Generic PVA @Tronxy", + "inherits": "fdm_filament_pva", + "from": "system", + "filament_id": "GFS99", + "setting_id": "GFSS99_Tronxy_00", + "instantiation": "true", + "filament_flow_ratio": [ + "0.95" + ], + "filament_max_volumetric_speed": [ + "12" + ], + "slow_down_layer_time": [ + "7" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Tronxy/filament/Generic TPU @Tronxy.json b/resources/profiles/Tronxy/filament/Generic TPU @Tronxy.json new file mode 100644 index 000000000..27b30cc02 --- /dev/null +++ b/resources/profiles/Tronxy/filament/Generic TPU @Tronxy.json @@ -0,0 +1,15 @@ +{ + "type": "filament", + "name": "Generic TPU @Tronxy", + "inherits": "fdm_filament_tpu", + "from": "system", + "filament_id": "GFU99", + "setting_id": "GFSU99_Tronxy_00", + "instantiation": "true", + "filament_max_volumetric_speed": [ + "3.2" + ], + "compatible_printers": [ + "Tronxy X5SA 400 0.4 nozzle" + ] +} \ No newline at end of file diff --git a/resources/profiles/Voron.json b/resources/profiles/Voron.json index 31cfd6685..b5b1a6cd0 100644 --- a/resources/profiles/Voron.json +++ b/resources/profiles/Voron.json @@ -183,4 +183,4 @@ "sub_path": "machine/Voron 0.1 0.4 nozzle.json" } ] -} +} \ No newline at end of file diff --git a/resources/profiles/Voron/machine/Voron 0.1 0.4 nozzle.json b/resources/profiles/Voron/machine/Voron 0.1 0.4 nozzle.json index bfd7347b2..2dbe2da2b 100644 --- a/resources/profiles/Voron/machine/Voron 0.1 0.4 nozzle.json +++ b/resources/profiles/Voron/machine/Voron 0.1 0.4 nozzle.json @@ -17,6 +17,9 @@ "0x120" ], "printable_height": "120", + "retract_lift_below":[ + "119" + ], "nozzle_type": "undefine", "auxiliary_fan": "0" } diff --git a/resources/profiles/Voron/machine/Voron 2.4 250 0.4 nozzle.json b/resources/profiles/Voron/machine/Voron 2.4 250 0.4 nozzle.json index cb2de09bb..670dbc633 100644 --- a/resources/profiles/Voron/machine/Voron 2.4 250 0.4 nozzle.json +++ b/resources/profiles/Voron/machine/Voron 2.4 250 0.4 nozzle.json @@ -15,5 +15,8 @@ "250x250", "0x250" ], - "printable_height": "225" + "printable_height": "225", + "retract_lift_below":[ + "224" + ] } diff --git a/resources/profiles/Voron/machine/Voron 2.4 300 0.4 nozzle.json b/resources/profiles/Voron/machine/Voron 2.4 300 0.4 nozzle.json index 48d0e127b..b175c8f22 100644 --- a/resources/profiles/Voron/machine/Voron 2.4 300 0.4 nozzle.json +++ b/resources/profiles/Voron/machine/Voron 2.4 300 0.4 nozzle.json @@ -15,5 +15,8 @@ "300x300", "0x300" ], - "printable_height": "275" + "printable_height": "275", + "retract_lift_below":[ + "274" + ] } diff --git a/resources/profiles/Voron/machine/Voron 2.4 350 0.4 nozzle.json b/resources/profiles/Voron/machine/Voron 2.4 350 0.4 nozzle.json index 7884fc5bb..bcf76ad5b 100644 --- a/resources/profiles/Voron/machine/Voron 2.4 350 0.4 nozzle.json +++ b/resources/profiles/Voron/machine/Voron 2.4 350 0.4 nozzle.json @@ -15,5 +15,8 @@ "350x350", "0x350" ], - "printable_height": "325" + "printable_height": "325", + "retract_lift_below":[ + "324" + ] } diff --git a/resources/profiles/Voron/machine/Voron Trident 250 0.4 nozzle.json b/resources/profiles/Voron/machine/Voron Trident 250 0.4 nozzle.json index d33c039ea..33d931c05 100644 --- a/resources/profiles/Voron/machine/Voron Trident 250 0.4 nozzle.json +++ b/resources/profiles/Voron/machine/Voron Trident 250 0.4 nozzle.json @@ -15,5 +15,8 @@ "250x250", "0x250" ], - "printable_height": "250" + "printable_height": "250", + "retract_lift_below":[ + "249" + ] } diff --git a/resources/profiles/Voron/machine/Voron Trident 300 0.4 nozzle.json b/resources/profiles/Voron/machine/Voron Trident 300 0.4 nozzle.json index c05ae2462..f36bf85ba 100644 --- a/resources/profiles/Voron/machine/Voron Trident 300 0.4 nozzle.json +++ b/resources/profiles/Voron/machine/Voron Trident 300 0.4 nozzle.json @@ -15,5 +15,8 @@ "300x300", "0x300" ], - "printable_height": "250" + "printable_height": "250", + "retract_lift_below":[ + "249" + ] } diff --git a/resources/profiles/Voron/machine/Voron Trident 350 0.4 nozzle.json b/resources/profiles/Voron/machine/Voron Trident 350 0.4 nozzle.json index c6b6f9f03..9caec25b5 100644 --- a/resources/profiles/Voron/machine/Voron Trident 350 0.4 nozzle.json +++ b/resources/profiles/Voron/machine/Voron Trident 350 0.4 nozzle.json @@ -15,5 +15,8 @@ "350x350", "0x350" ], - "printable_height": "250" + "printable_height": "250", + "retract_lift_below":[ + "249" + ] } diff --git a/resources/profiles/Voxelab.json b/resources/profiles/Voxelab.json index 053f25050..c639f94b8 100644 --- a/resources/profiles/Voxelab.json +++ b/resources/profiles/Voxelab.json @@ -64,4 +64,4 @@ "sub_path": "machine/Voxelab Aquila X2 0.4 nozzle.json" } ] -} +} \ No newline at end of file diff --git a/resources/profiles/blacklist.json b/resources/profiles/blacklist.json new file mode 100644 index 000000000..e876cdca8 --- /dev/null +++ b/resources/profiles/blacklist.json @@ -0,0 +1,8 @@ +{ + "filament": [ + "GFSA03" + ], + "process": [ + "GP008" + ] +} \ No newline at end of file diff --git a/resources/profiles/check_unused_setting_id.py b/resources/profiles/check_unused_setting_id.py new file mode 100644 index 000000000..14888a87b --- /dev/null +++ b/resources/profiles/check_unused_setting_id.py @@ -0,0 +1,54 @@ +import os +import json + +setting_id_used=set() +setting_id_all=set() +root_dir=os.path.dirname(os.path.abspath(__file__)) + + +def loadBlackList(): + with open(root_dir+'/blacklist.json') as file: + data=json.load(file) + + for key,val in data.items(): + for item in val: + setting_id_used.add(item) + setting_id_all.add(item) + +def traverse_files(path): + for file in os.listdir(path): + file_path = os.path.join(path, file) + if os.path.isdir(file_path): + traverse_files(file_path) # 递归遍历子文件夹 + elif file_path.endswith('.json'): + # 解析 JSON 文件并提取 setting_id 的值 + with open(file_path) as f: + data = json.load(f) + if 'setting_id' in data: + setting_id_all.add(data['setting_id']) + +def getUsedId(brand): + with open(root_dir+'/'+brand+'.json')as file: + data=json.load(file) + + key_list=["machine_model_list","machine_list","filament_list","process_list"] + + for key in key_list: + for elem in data[key]: + path=elem['sub_path'] + with open(root_dir+'/'+brand+'/'+path) as file: + file_data=json.load(file) + if 'setting_id' in file_data: + setting_id_used.add(file_data['setting_id']) + + +def getTotalId(brand): + traverse_files(root_dir+'/'+brand) + + +loadBlackList() +getUsedId('BBL') +getTotalId('BBL') + +print("unused setting_id :") +print(setting_id_all.difference(setting_id_used)) diff --git a/resources/web/orca/missing_connection.html b/resources/web/orca/missing_connection.html index a66ea4561..64f14dfea 100644 --- a/resources/web/orca/missing_connection.html +++ b/resources/web/orca/missing_connection.html @@ -14,8 +14,8 @@
-

Printer Connection

-

Please set up your printer connection to view the device.

+

Printer Connection

+

Please set up your printer connection to view the device.

Printer connection setup demonstration
diff --git a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp index ae0fcb36e..d4036c109 100644 --- a/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp +++ b/src/libnest2d/include/libnest2d/placers/nfpplacer.hpp @@ -37,8 +37,9 @@ struct NfpPConfig { BOTTOM_RIGHT, TOP_LEFT, TOP_RIGHT, - DONT_ALIGN //!> Warning: parts may end up outside the bin with the + DONT_ALIGN, //!> Warning: parts may end up outside the bin with the //! default object function. + USER_DEFINED }; /// Which angles to try out for better results. @@ -50,6 +51,8 @@ struct NfpPConfig { /// Where to start putting objects in the bin. Alignment starting_point; + TPoint best_object_pos; + /** * @brief A function object representing the fitting function in the * placement optimization process. (Optional) @@ -1093,6 +1096,11 @@ private: cb = bbin.maxCorner(); break; } + case Config::Alignment::USER_DEFINED: { + ci = bb.center(); + cb = config_.best_object_pos; + break; + } default: ; // DONT_ALIGN } @@ -1115,11 +1123,9 @@ private: return; { // find a best position inside NFP of fixed items (excluded regions), so the center of pile is cloest to bed center RawShape objs_convex_hull = sl::convexHull(objs); - for (const Item &item : config_.m_excluded_regions) { excludes.push_back(item.transformedShape()); } for (const Item &item : items_) { if (item.isFixed()) { - if (!(item.is_wipe_tower && !need_wipe_tower)) - excludes.push_back(item.transformedShape()); + excludes.push_back(item.transformedShape()); } } diff --git a/src/libslic3r/Arrange.cpp b/src/libslic3r/Arrange.cpp index 9b4f493ef..3ea4955fe 100644 --- a/src/libslic3r/Arrange.cpp +++ b/src/libslic3r/Arrange.cpp @@ -80,20 +80,196 @@ using ItemGroup = std::vector>; const double BIG_ITEM_TRESHOLD = 0.02; #define VITRIFY_TEMP_DIFF_THRSH 15 // bed temp can be higher than vitrify temp, but not higher than this thresh +void update_arrange_params(ArrangeParams& params, const DynamicPrintConfig& print_cfg, const ArrangePolygons& selected) +{ + double skirt_distance = get_real_skirt_dist(print_cfg); + // Note: skirt_distance is now defined between outermost brim and skirt, not the object and skirt. + // So we can't do max but do adding instead. + params.brim_skirt_distance = skirt_distance; + params.bed_shrink_x = params.brim_skirt_distance; + params.bed_shrink_y = params.brim_skirt_distance; + // for sequential print, we need to inflate the bed because cleareance_radius is so large + if (params.is_seq_print) { + float shift_dist = params.cleareance_radius / 2 - 5; + params.bed_shrink_x -= shift_dist; + params.bed_shrink_y -= shift_dist; + } +} + +void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPrintConfig* print_cfg, ArrangeParams& params) { + // do not inflate brim_width. Objects are allowed to have overlapped brim. + Points bedpts = get_shrink_bedpts(print_cfg, params); + BoundingBox bedbb = Polygon(bedpts).bounding_box(); + // set obj distance for auto seq_print + if (params.min_obj_distance == 0 && params.is_seq_print) + params.min_obj_distance = scaled(params.cleareance_radius + 0.001); + double brim_max = 0; + bool plate_has_tree_support = false; + std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon& ap) { + brim_max = std::max(brim_max, ap.brim_width); + if (ap.has_tree_support) plate_has_tree_support = true; }); + std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon& ap) { + // 1. if user input a distance, use it + // 2. if there is an object with tree support, all objects use the max tree branch radius (brim_max=branch diameter) + // 3. otherwise, use each object's own brim width + ap.inflation = params.min_obj_distance != 0 ? params.min_obj_distance / 2 : + plate_has_tree_support ? scaled(brim_max / 2) : scaled(ap.brim_width); + BoundingBox apbb = ap.poly.contour.bounding_box(); + auto diffx = bedbb.size().x() - apbb.size().x() - 5; + auto diffy = bedbb.size().y() - apbb.size().y() - 5; + if (diffx > 0 && diffy > 0) { + auto min_diff = std::min(diffx, diffy); + ap.inflation = std::min(min_diff / 2, ap.inflation); + } + }); +} + +void update_unselected_items_inflation(ArrangePolygons& unselected, const DynamicPrintConfig* print_cfg, const ArrangeParams& params) +{ + if (params.is_seq_print) { + float shift_dist = params.cleareance_radius / 2 - 5; + // dont forget to move the excluded region + for (auto& region : unselected) { + if (region.is_virt_object) region.poly.translate(-scaled(shift_dist), -scaled(shift_dist)); + } + } + // For occulusion regions, inflation should be larger to prevent genrating brim on them. + // However, extrusion cali regions are exceptional, since we can allow brim overlaps them. + // 屏蔽区域只需要膨胀brim宽度,防止brim长过去;挤出标定区域不需要膨胀,brim可以长过去。 + // 以前我们认为还需要膨胀clearance_radius/2,这其实是不需要的,因为这些区域并不会真的摆放物体, + // 其他物体的膨胀轮廓是可以跟它们重叠的。 + double scaled_exclusion_gap = scale_(1); + std::for_each(unselected.begin(), unselected.end(), + [&](auto& ap) { ap.inflation = !ap.is_virt_object ? (params.min_obj_distance == 0 ? scaled(ap.brim_width) : params.min_obj_distance / 2) + : (ap.is_extrusion_cali_object ? 0 : scaled_exclusion_gap); }); +} + +void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPrintConfig* print_cfg, const ArrangeParams& params) +{ + // now only need to consider "Align to x axis" + if (!params.align_to_y_axis) + return; + + for (ArrangePolygon& ap : selected) { + bool validResult = false; + double angle = 0.0; + { + const auto& pts = ap.transformed_poly().contour; + int lpt = pts.size(); + double a00 = 0, a10 = 0, a01 = 0, a20 = 0, a11 = 0, a02 = 0, a30 = 0, a21 = 0, a12 = 0, a03 = 0; + double xi, yi, xi2, yi2, xi_1, yi_1, xi_12, yi_12, dxy, xii_1, yii_1; + xi_1 = pts.back().x(); + yi_1 = pts.back().y(); + + xi_12 = xi_1 * xi_1; + yi_12 = yi_1 * yi_1; + + for (int i = 0; i < lpt; i++) { + xi = pts[i].x(); + yi = pts[i].y(); + + xi2 = xi * xi; + yi2 = yi * yi; + dxy = xi_1 * yi - xi * yi_1; + xii_1 = xi_1 + xi; + yii_1 = yi_1 + yi; + + a00 += dxy; + a10 += dxy * xii_1; + a01 += dxy * yii_1; + a20 += dxy * (xi_1 * xii_1 + xi2); + a11 += dxy * (xi_1 * (yii_1 + yi_1) + xi * (yii_1 + yi)); + a02 += dxy * (yi_1 * yii_1 + yi2); + a30 += dxy * xii_1 * (xi_12 + xi2); + a03 += dxy * yii_1 * (yi_12 + yi2); + a21 += dxy * (xi_12 * (3 * yi_1 + yi) + 2 * xi * xi_1 * yii_1 + xi2 * (yi_1 + 3 * yi)); + a12 += dxy * (yi_12 * (3 * xi_1 + xi) + 2 * yi * yi_1 * xii_1 + yi2 * (xi_1 + 3 * xi)); + xi_1 = xi; + yi_1 = yi; + xi_12 = xi2; + yi_12 = yi2; + } + + if (std::abs(a00) > EPSILON) { + double db1_2, db1_6, db1_12, db1_24, db1_20, db1_60; + double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; + if (a00 > 0) { + db1_2 = 0.5; + db1_6 = 0.16666666666666666666666666666667; + db1_12 = 0.083333333333333333333333333333333; + db1_24 = 0.041666666666666666666666666666667; + db1_20 = 0.05; + db1_60 = 0.016666666666666666666666666666667; + } + else { + db1_2 = -0.5; + db1_6 = -0.16666666666666666666666666666667; + db1_12 = -0.083333333333333333333333333333333; + db1_24 = -0.041666666666666666666666666666667; + db1_20 = -0.05; + db1_60 = -0.016666666666666666666666666666667; + } + m00 = a00 * db1_2; + m10 = a10 * db1_6; + m01 = a01 * db1_6; + m20 = a20 * db1_12; + m11 = a11 * db1_24; + m02 = a02 * db1_12; + m30 = a30 * db1_20; + m21 = a21 * db1_60; + m12 = a12 * db1_60; + m03 = a03 * db1_20; + + double cx = m10 / m00; + double cy = m01 / m00; + + double a = m20 / m00 - cx * cx; + double b = m11 / m00 - cx * cy; + double c = m02 / m00 - cy * cy; + + //if a and c are close, there is no dominant axis, then do not rotate + if (std::abs(a) < 1.5*std::abs(c) && std::abs(c) < 1.5*std::abs(a)) { + validResult = false; + } + else { + angle = std::atan2(2 * b, (a - c)) / 2; + validResult = true; + } + } + } + if (validResult) { ap.rotation += (PI / 2 - angle); } + } +} + +//it will bed accurate after call update_params +Points get_shrink_bedpts(const DynamicPrintConfig* print_cfg, const ArrangeParams& params) +{ + Points bedpts = get_bed_shape(*print_cfg); + // shrink bed by moving to center by dist + auto shrinkFun = [](Points& bedpts, double dist, int direction) { +#define SGN(x) ((x) >= 0 ? 1 : -1) + Point center = Polygon(bedpts).bounding_box().center(); + for (auto& pt : bedpts) pt[direction] += dist * SGN(center[direction] - pt[direction]); + }; + shrinkFun(bedpts, scaled(params.bed_shrink_x), 0); + shrinkFun(bedpts, scaled(params.bed_shrink_y), 1); + return bedpts; +} + // Fill in the placer algorithm configuration with values carefully chosen for // Slic3r. template void fill_config(PConf& pcfg, const ArrangeParams ¶ms) { - - if (params.is_seq_print) { - // Start placing the items from the center of the print bed - pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT; - } - else { - // Start placing the items from the center of the print bed - pcfg.starting_point = PConf::Alignment::TOP_RIGHT; - } - + + if (params.is_seq_print) { + // Start placing the items from the center of the print bed + pcfg.starting_point = PConf::Alignment::BOTTOM_LEFT; + } + else { + // Start placing the items from the center of the print bed + pcfg.starting_point = PConf::Alignment::TOP_RIGHT; + } + if (params.do_final_align) { // Align the arranged pile into the center of the bin pcfg.alignment = PConf::Alignment::CENTER; @@ -495,6 +671,14 @@ public: m_norm = std::sqrt(m_bin_area); fill_config(m_pconf, params); this->params = params; + + // if best object center is not bed center, specify starting point here + if (std::abs(this->params.align_center.x() - 0.5) > 0.001 || std::abs(this->params.align_center.y() - 0.5) > 0.001) { + auto binbb = sl::boundingBox(m_bin); + m_pconf.best_object_pos = binbb.minCorner() + Point{ binbb.width() * this->params.align_center.x(), binbb.height() * this->params.align_center.y() }; + m_pconf.alignment = PConfig::Alignment::USER_DEFINED; + } + for (auto& region : m_pconf.m_excluded_regions) { Box bb = region.boundingBox(); m_excluded_and_extruCali_regions.emplace_back(bb); @@ -551,6 +735,7 @@ public: for (Item itm : items) { if (itm.is_wipe_tower) { starting_point = itm.boundingBox().center(); + BOOST_LOG_TRIVIAL(debug) << "arrange we have wipe tower, change starting point to: " << starting_point; break; } } @@ -575,15 +760,13 @@ public: if (on_packed) on_packed(ap); BOOST_LOG_TRIVIAL(debug) << "arrange " + last_packed.name + " succeed!" - << ", plate id=" << ap.bed_idx; + << ", plate id=" << ap.bed_idx << ", pos=" << last_packed.translation(); } }); - if (progressind) { - m_pck.unfitIndicator([this, progressind](std::string name) { - BOOST_LOG_TRIVIAL(debug) << "arrange not fit: " + name; + m_pck.unfitIndicator([this](std::string name) { + BOOST_LOG_TRIVIAL(debug) << "arrange progress: " + name; }); - } if (stopcond) m_pck.stopCondition(stopcond); diff --git a/src/libslic3r/Arrange.hpp b/src/libslic3r/Arrange.hpp index a9b7cc484..352ca846e 100644 --- a/src/libslic3r/Arrange.hpp +++ b/src/libslic3r/Arrange.hpp @@ -2,7 +2,7 @@ #define ARRANGE_HPP #include "ExPolygon.hpp" - +#include "PrintConfig.hpp" namespace Slic3r { class BoundingBox; @@ -53,7 +53,8 @@ struct ArrangePolygon { int locked_plate{ -1 }; bool is_virt_object{ false }; bool is_extrusion_cali_object{ false }; - bool is_wipe_tower{false}; + bool is_wipe_tower{ false }; + bool has_tree_support{false}; //BBS: add row/col for sudoku-style layout int row{0}; int col{0}; @@ -120,6 +121,7 @@ struct ArrangeParams { bool allow_multi_materials_on_same_plate = true; bool avoid_extrusion_cali_region = true; bool is_seq_print = false; + bool align_to_y_axis = false; float bed_shrink_x = 0; float bed_shrink_y = 0; float brim_skirt_distance = 0; @@ -127,6 +129,7 @@ struct ArrangeParams { float clearance_height_to_lid = 0; float cleareance_radius = 0; float printable_height = 256.0; + Vec2d align_center{ 0.5,0.5 }; ArrangePolygons excluded_regions; // regions cant't be used ArrangePolygons nonprefered_regions; // regions can be used but not prefered @@ -144,8 +147,39 @@ struct ArrangeParams { ArrangeParams() = default; explicit ArrangeParams(coord_t md) : min_obj_distance(md) {} + // to json format + std::string to_json() const{ + std::string ret = "{"; + ret += "\"min_obj_distance\":" + std::to_string(min_obj_distance) + ","; + ret += "\"accuracy\":" + std::to_string(accuracy) + ","; + ret += "\"parallel\":" + std::to_string(parallel) + ","; + ret += "\"allow_rotations\":" + std::to_string(allow_rotations) + ","; + ret += "\"do_final_align\":" + std::to_string(do_final_align) + ","; + ret += "\"allow_multi_materials_on_same_plate\":" + std::to_string(allow_multi_materials_on_same_plate) + ","; + ret += "\"avoid_extrusion_cali_region\":" + std::to_string(avoid_extrusion_cali_region) + ","; + ret += "\"is_seq_print\":" + std::to_string(is_seq_print) + ","; + ret += "\"bed_shrink_x\":" + std::to_string(bed_shrink_x) + ","; + ret += "\"bed_shrink_y\":" + std::to_string(bed_shrink_y) + ","; + ret += "\"brim_skirt_distance\":" + std::to_string(brim_skirt_distance) + ","; + ret += "\"clearance_height_to_rod\":" + std::to_string(clearance_height_to_rod) + ","; + ret += "\"clearance_height_to_lid\":" + std::to_string(clearance_height_to_lid) + ","; + ret += "\"cleareance_radius\":" + std::to_string(cleareance_radius) + ","; + ret += "\"printable_height\":" + std::to_string(printable_height) + ","; + return ret; + } + }; +void update_arrange_params(ArrangeParams& params, const DynamicPrintConfig& print_cfg, const ArrangePolygons& selected); + +void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPrintConfig* print_cfg, ArrangeParams& params); + +void update_unselected_items_inflation(ArrangePolygons& unselected, const DynamicPrintConfig* print_cfg, const ArrangeParams& params); + +void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPrintConfig* print_cfg, const ArrangeParams& params); + +Points get_shrink_bedpts(const DynamicPrintConfig* print_cfg, const ArrangeParams& params); + /** * \brief Arranges the input polygons. * diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 76b6c3061..a6e3a1683 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -416,6 +416,8 @@ set(lisbslic3r_sources if (APPLE) list(APPEND lisbslic3r_sources MacUtils.mm + Format/ModelIO.hpp + Format/ModelIO.mm ) endif () @@ -532,6 +534,12 @@ if(NOT WIN32) endif() endif() +if (APPLE) + find_library(FOUNDATION Foundation REQUIRED) + find_library(MODELIO ModelIO REQUIRED) + target_link_libraries(libslic3r ${FOUNDATION} ${MODELIO}) +endif () + if (TARGET OpenVDB::openvdb) target_link_libraries(libslic3r OpenVDB::openvdb) endif() diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp index 8522d5965..439eb9779 100644 --- a/src/libslic3r/Config.cpp +++ b/src/libslic3r/Config.cpp @@ -786,6 +786,7 @@ int ConfigBase::load_from_json(const std::string &file, ConfigSubstitutionContex try { boost::nowide::ifstream ifs(file); ifs >> j; + ifs.close(); const ConfigDef* config_def = this->def(); if (config_def == nullptr) { diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 37c778c3b..d1a7347df 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -534,23 +534,26 @@ public: } return false; } - size_t i = 0; + size_t cnt = std::min(this->size(), rhs_vec->size()); - bool modified = false; - for (; i < cnt; ++ i) - if (! rhs_vec->is_nil(i) && this->values[i] != rhs_vec->values[i]) { - this->values[i] = rhs_vec->values[i]; - modified = true; - } - for (; i < rhs_vec->size(); ++ i) - if (! rhs_vec->is_nil(i)) { - if (this->values.empty()) - this->values.resize(i + 1); - else - this->values.resize(i + 1, this->values.front()); - this->values[i] = rhs_vec->values[i]; - modified = true; - } + if (cnt < 1) + return false; + + if (this->values.empty()) + this->values.resize(rhs_vec->size()); + else + this->values.resize(rhs_vec->size(), this->values.front()); + + bool modified = false; + auto default_value = this->values[0]; + for (size_t i = 0; i < rhs_vec->size(); ++i) { + if (!rhs_vec->is_nil(i)) { + this->values[i] = rhs_vec->values[i]; + modified = true; + } else { + this->values[i] = default_value; + } + } return modified; } diff --git a/src/libslic3r/CustomGCode.hpp b/src/libslic3r/CustomGCode.hpp index 5b21bb45e..7d8c7d998 100644 --- a/src/libslic3r/CustomGCode.hpp +++ b/src/libslic3r/CustomGCode.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace Slic3r { @@ -43,6 +44,24 @@ struct Item std::string extra; // this field is used for the extra data like : // - G-code text for the Type::Custom // - message text for the Type::PausePrint + void from_json(const nlohmann::json& j) { + std::string type_str; + j.at("type").get_to(type_str); + std::map str2type = { {"ColorChange", ColorChange }, + {"PausePrint",PausePrint}, + {"ToolChange",ToolChange}, + {"Template",Template}, + {"Custom",Custom}, + {"Unknown",Unknown} }; + type = Unknown; + if (str2type.find(type_str) != str2type.end()) + type = str2type[type_str]; + j.at("print_z").get_to(print_z); + j.at("color").get_to(color); + j.at("extruder").get_to(extruder); + if(j.contains("extra")) + j.at("extra").get_to(extra); + } }; enum Mode @@ -71,6 +90,24 @@ struct Info (rhs.gcodes == this->gcodes ); } bool operator!=(const Info& rhs) const { return !(*this == rhs); } + + void from_json(const nlohmann::json& j) { + std::string mode_str; + if (j.contains("mode")) + j.at("mode").get_to(mode_str); + if (mode_str == "SingleExtruder") mode = SingleExtruder; + else if (mode_str == "MultiAsSingle") mode = MultiAsSingle; + else if (mode_str == "MultiExtruder") mode = MultiExtruder; + else mode = Undef; + + auto j_gcodes = j.at("gcodes"); + gcodes.reserve(j_gcodes.size()); + for (auto& jj : j_gcodes) { + Item item; + item.from_json(jj); + gcodes.push_back(item); + } + } }; // If loaded configuration has a "colorprint_heights" option (if it was imported from older Slicer), diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index 30b81f4cd..f66ddee71 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -689,7 +689,7 @@ void Layer::make_ironing() // Check whether there is any non-solid hole in the regions. bool internal_infill_solid = region_config.sparse_infill_density.value > 95.; for (const Surface &surface : ironing_params.layerm->fill_surfaces.surfaces) - if ((! internal_infill_solid && surface.surface_type == stInternal) || surface.surface_type == stInternalBridge || surface.surface_type == stInternalVoid) { + if ((!internal_infill_solid && surface.surface_type == stInternal) || surface.surface_type == stInternalBridge || surface.surface_type == stInternalVoid || surface.surface_type==stInternalWithLoop) { // Some fill region is not quite solid. Don't iron over the whole surface. iron_completely = false; break; @@ -701,7 +701,7 @@ void Layer::make_ironing() polygons_append(polys, surface.expolygon); } else { for (const Surface &surface : ironing_params.layerm->slices.surfaces) - if (surface.surface_type == stTop || (iron_everything && surface.surface_type == stBottom)) + if ((surface.surface_type == stTop && region_config.top_shell_layers > 0) || (iron_everything && surface.surface_type == stBottom && region_config.bottom_shell_layers > 0)) // stBottomBridge is not being ironed on purpose, as it would likely destroy the bridges. polygons_append(polys, surface.expolygon); } diff --git a/src/libslic3r/Format/ModelIO.hpp b/src/libslic3r/Format/ModelIO.hpp new file mode 100644 index 000000000..a0751f2d9 --- /dev/null +++ b/src/libslic3r/Format/ModelIO.hpp @@ -0,0 +1,19 @@ +#include + +namespace Slic3r { + /** + * Uses ModelIO to convert supported model types to a temporary STL + * that can then be consumed by the existing STL loader + * @param input_file The File to load + * @return Path to the temporary file, or an empty string if conversion failed + */ + std::string make_temp_stl_with_modelio(const std::string &input_file); + + /** + * Convenience function to delete the file. + * No return value since success isn't required + * @param temp_file File path to delete + */ + void delete_temp_file(const std::string &temp_file); +} + diff --git a/src/libslic3r/Format/ModelIO.mm b/src/libslic3r/Format/ModelIO.mm new file mode 100644 index 000000000..7d1d4e726 --- /dev/null +++ b/src/libslic3r/Format/ModelIO.mm @@ -0,0 +1,27 @@ +#include "ModelIO.hpp" +#import + +namespace Slic3r { + + std::string make_temp_stl_with_modelio(const std::string &input_file) + { + NSURL *input_url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:input_file.c_str()]]; + MDLAsset *asset = [[MDLAsset alloc] initWithURL:input_url]; + + NSString *tmp_file_name = [[[NSUUID UUID] UUIDString] stringByAppendingPathExtension:@"stl"]; + NSURL *tmp_file_url = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:tmp_file_name]]; + + if ([asset exportAssetToURL:tmp_file_url]) { + std::string output_file = std::string([[tmp_file_url path] UTF8String]); + return output_file; + } + + return std::string(); + } + void delete_temp_file(const std::string &temp_file) + { + NSString *file_path = [NSString stringWithUTF8String:temp_file.c_str()]; + [[NSFileManager defaultManager] removeItemAtPath:file_path error:NULL]; + } + +} // namespace Slic3r \ No newline at end of file diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index c2f24d782..8709e7793 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -116,6 +116,7 @@ const std::string BBL_DESIGNER_USER_ID_TAG = "DesignerUserId"; const std::string BBL_DESIGNER_COVER_FILE_TAG = "DesignerCover"; const std::string BBL_DESCRIPTION_TAG = "Description"; const std::string BBL_COPYRIGHT_TAG = "CopyRight"; +const std::string BBL_COPYRIGHT_NORMATIVE_TAG = "Copyright"; const std::string BBL_LICENSE_TAG = "License"; const std::string BBL_REGION_TAG = "Region"; const std::string BBL_MODIFICATION_TAG = "ModificationDate"; @@ -226,11 +227,14 @@ static constexpr const char* HIT_NORMAL_ATTR = "hit_normal"; // BBS: encrypt static constexpr const char* RELATIONSHIP_TAG = "Relationship"; static constexpr const char* PID_ATTR = "pid"; -static constexpr const char* PUUID_ATTR = "p:uuid"; +static constexpr const char* PUUID_ATTR = "p:UUID"; +static constexpr const char* PUUID_LOWER_ATTR = "p:uuid"; static constexpr const char* PPATH_ATTR = "p:path"; static constexpr const char *OBJECT_UUID_SUFFIX = "-61cb-4c03-9d28-80fed5dfa1dc"; static constexpr const char *OBJECT_UUID_SUFFIX2 = "-71cb-4c03-9d28-80fed5dfa1dc"; -static constexpr const char* BUILD_UUID = "d8eb061-b1ec-4553-aec9-835e5b724bb4"; +static constexpr const char *SUB_OBJECT_UUID_SUFFIX = "-81cb-4c03-9d28-80fed5dfa1dc"; +static constexpr const char *COMPONENT_UUID_SUFFIX = "-b206-40ff-9872-83e8017abed1"; +static constexpr const char* BUILD_UUID = "2c7c17d8-22b5-4d84-8835-1976022ea369"; static constexpr const char* BUILD_UUID_SUFFIX = "-b1ec-4553-aec9-835e5b724bb4"; static constexpr const char* TARGET_ATTR = "Target"; static constexpr const char* RELS_TYPE_ATTR = "Type"; @@ -281,6 +285,8 @@ static constexpr const char* PLATER_NAME_ATTR = "plater_name"; static constexpr const char* PLATE_IDX_ATTR = "index"; static constexpr const char* SLICE_PREDICTION_ATTR = "prediction"; static constexpr const char* SLICE_WEIGHT_ATTR = "weight"; +static constexpr const char* TIMELAPSE_TYPE_ATTR = "timelapse_type"; +static constexpr const char* TIMELAPSE_ERROR_CODE_ATTR = "timelapse_error_code"; static constexpr const char* OUTSIDE_ATTR = "outside"; static constexpr const char* SUPPORT_USED_ATTR = "support_used"; static constexpr const char* LABEL_OBJECT_ENABLED_ATTR = "label_object_enabled"; @@ -1679,7 +1685,12 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) std::string name(stat.m_filename); std::replace(name.begin(), name.end(), '\\', '/'); - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format("extract %1%th file %2%, total=%3%\n")%(i+1)%name%num_entries; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format("extract %1%th file %2%, total=%3%")%(i+1)%name%num_entries; + + if (name.find("/../") != std::string::npos) { + BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", find file path including /../, not valid, skip it\n"); + continue; + } if (boost::algorithm::iequals(name, BBS_LAYER_HEIGHTS_PROFILE_FILE)) { // extract slic3r layer heights profile file @@ -1763,6 +1774,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) //BBS parsing pattern config files _extract_file_from_archive(archive, stat); } + else { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format(", %1% skipped, already parsed or a directory or not supported\n")%name; + } } } @@ -2175,7 +2189,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) } } char error_buf[1024]; - ::sprintf(error_buf, "File %s not found from archive", path.c_str()); + ::snprintf(error_buf, 1024, "File %s not found from archive", path.c_str()); add_error(error_buf); return false; } @@ -2234,7 +2248,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) if (!XML_ParseBuffer(m_xml_parser, (int)stat.m_uncomp_size, 1)) { char error_buf[1024]; - ::sprintf(error_buf, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), (int)XML_GetCurrentLineNumber(m_xml_parser)); + ::snprintf(error_buf, 1024, "Error (%s) while parsing xml file at line %d", XML_ErrorString(XML_GetErrorCode(m_xml_parser)), (int)XML_GetCurrentLineNumber(m_xml_parser)); add_error(error_buf); return false; } @@ -2280,7 +2294,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) CallbackData* data = (CallbackData*)pOpaque; if (!XML_Parse(data->parser, (const char*)pBuf, (int)n, (file_ofs + n == data->stat.m_uncomp_size) ? 1 : 0) || data->importer.parse_error()) { char error_buf[1024]; - ::sprintf(error_buf, "Error (%s) while parsing '%s' at line %d", data->importer.parse_error_message(), data->stat.m_filename, (int)XML_GetCurrentLineNumber(data->parser)); + ::snprintf(error_buf, 1024, "Error (%s) while parsing '%s' at line %d", data->importer.parse_error_message(), data->stat.m_filename, (int)XML_GetCurrentLineNumber(data->parser)); throw Slic3r::FileIOError(error_buf); } return n; @@ -2501,6 +2515,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) void _BBS_3MF_Importer::_extract_auxiliary_file_from_archive(mz_zip_archive& archive, const mz_zip_archive_file_stat& stat, Model& model) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", stat.m_uncomp_size is %1%")%stat.m_uncomp_size; if (stat.m_uncomp_size > 0) { std::string dest_file; if (stat.m_is_utf8) { @@ -2518,6 +2533,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) dest_file = dest_file.substr(found + AUXILIARY_STR_LEN); else return; + if (dest_file.find('/') != std::string::npos) { boost::filesystem::path src_path = boost::filesystem::path(dest_file); boost::filesystem::path parent_path = src_path.parent_path(); @@ -3175,6 +3191,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) m_curr_object->name = bbs_get_attribute_value_string(attributes, num_attributes, NAME_ATTR); m_curr_object->uuid = bbs_get_attribute_value_string(attributes, num_attributes, PUUID_ATTR); + if (m_curr_object->uuid.empty()) { + m_curr_object->uuid = bbs_get_attribute_value_string(attributes, num_attributes, PUUID_LOWER_ATTR); + } m_curr_object->pid = bbs_get_attribute_value_int(attributes, num_attributes, PID_ATTR); } @@ -3563,7 +3582,10 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) BOOST_LOG_TRIVIAL(trace) << "design_info, load_3mf found license = " << m_curr_characters; model_info.license = xml_unescape(m_curr_characters); } else if (m_curr_metadata_name == BBL_COPYRIGHT_TAG) { - BOOST_LOG_TRIVIAL(trace) << "design_info, load_3mf found copyright = " << m_curr_characters; + BOOST_LOG_TRIVIAL(trace) << "design_info, load_3mf found CopyRight = " << m_curr_characters; + model_info.copyright = xml_unescape(m_curr_characters); + } else if (m_curr_metadata_name == BBL_COPYRIGHT_NORMATIVE_TAG) { + BOOST_LOG_TRIVIAL(trace) << "design_info, load_3mf found Copyright = " << m_curr_characters; model_info.copyright = xml_unescape(m_curr_characters); } else if (m_curr_metadata_name == BBL_REGION_TAG) { BOOST_LOG_TRIVIAL(trace) << "design_info, load_3mf found region = " << m_curr_characters; @@ -4027,7 +4049,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) { if (!m_curr_plater) { - add_error("don't find plater created before"); + add_error("_handle_end_config_plater: don't find plate created before"); return false; } m_plater_data.emplace(m_curr_plater->plate_index, m_curr_plater); @@ -4039,7 +4061,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) { if (!m_curr_plater) { - add_error("don't find plater created before"); + add_error("_handle_start_config_plater_instance: don't find plate created before"); return false; } @@ -4051,7 +4073,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) { if (!m_curr_plater) { - add_error("don't find plater created before"); + add_error("_handle_end_config_plater_instance: don't find plate created before"); return false; } if ((m_curr_instance.object_id == -1) || (m_curr_instance.instance_id == -1)) @@ -4430,6 +4452,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) volume->supported_facets.shrink_to_fit(); volume->seam_facets.shrink_to_fit(); volume->mmu_segmentation_facets.shrink_to_fit(); + volume->mmu_segmentation_facets.touch(); } volume->set_type(volume_data->part_type); @@ -4709,6 +4732,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) current_object->name = bbs_get_attribute_value_string(attributes, num_attributes, NAME_ATTR); current_object->uuid = bbs_get_attribute_value_string(attributes, num_attributes, PUUID_ATTR); + if (current_object->uuid.empty()) { + current_object->uuid = bbs_get_attribute_value_string(attributes, num_attributes, PUUID_LOWER_ATTR); + } current_object->pid = bbs_get_attribute_value_int(attributes, num_attributes, PID_ATTR); } @@ -5096,7 +5122,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) CallbackData* data = (CallbackData*)pOpaque; if (!XML_Parse(data->parser, (const char*)pBuf, (int)n, (file_ofs + n == data->stat.m_uncomp_size) ? 1 : 0) || data->importer.object_parse_error()) { char error_buf[1024]; - ::sprintf(error_buf, "Error (%s) while parsing '%s' at line %d", data->importer.object_parse_error_message(), data->stat.m_filename, (int)XML_GetCurrentLineNumber(data->parser)); + ::snprintf(error_buf, 1024, "Error (%s) while parsing '%s' at line %d", data->importer.object_parse_error_message(), data->stat.m_filename, (int)XML_GetCurrentLineNumber(data->parser)); throw Slic3r::FileIOError(error_buf); } return n; @@ -5219,7 +5245,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) bool _add_content_types_file_to_archive(mz_zip_archive& archive); - bool _add_thumbnail_file_to_archive(mz_zip_archive& archive, const ThumbnailData& thumbnail_data, const char* local_path, int index); + bool _add_thumbnail_file_to_archive(mz_zip_archive& archive, const ThumbnailData& thumbnail_data, const char* local_path, int index, bool generate_small_thumbnail = false); bool _add_calibration_file_to_archive(mz_zip_archive& archive, const ThumbnailData& thumbnail_data, int index); bool _add_bbox_file_to_archive(mz_zip_archive& archive, const PlateBBoxData& id_bboxes, int index); bool _add_relationships_file_to_archive(mz_zip_archive & archive, @@ -5245,7 +5271,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) bool _add_project_embedded_presets_to_archive(mz_zip_archive& archive, Model& model, std::vector project_presets); bool _add_model_config_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, const ObjectToObjectDataMap &objects_data, int export_plate_idx = -1, bool save_gcode = true, bool use_loaded_id = false); bool _add_cut_information_file_to_archive(mz_zip_archive &archive, Model &model); - bool _add_slice_info_config_file_to_archive(mz_zip_archive &archive, const Model &model, PlateDataPtrs &plate_data_list, const ObjectToObjectDataMap &objects_data); + bool _add_slice_info_config_file_to_archive(mz_zip_archive &archive, const Model &model, PlateDataPtrs &plate_data_list, const ObjectToObjectDataMap &objects_data, const DynamicPrintConfig& config); bool _add_gcode_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, Export3mfProgressFn proFn = nullptr); bool _add_custom_gcode_per_print_z_file_to_archive(mz_zip_archive& archive, Model& model, const DynamicPrintConfig* config); bool _add_auxiliary_dir_to_archive(mz_zip_archive &archive, const std::string &aux_dir, PackingTemporaryData &data); @@ -5464,9 +5490,10 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) { if (thumbnail_data[index]->is_valid()) { - if (!_add_thumbnail_file_to_archive(archive, *thumbnail_data[index], "Metadata/plate", index)) { + if (!_add_thumbnail_file_to_archive(archive, *thumbnail_data[index], "Metadata/plate", index, true)) { return false; } + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" <<__LINE__ << boost::format(",add thumbnail %1%'s data into 3mf")%(index+1); thumbnail_status[index] = true; } @@ -5746,7 +5773,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) // Adds sliced info of plate file ("Metadata/slice_info.config") // This file contains all sliced info of all plates - if (!_add_slice_info_config_file_to_archive(archive, model, plate_data_list, objects_data)) { + if (!_add_slice_info_config_file_to_archive(archive, model, plate_data_list, objects_data, *config)) { BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format(", _add_slice_info_config_file_to_archive failed\n"); return false; } @@ -5843,7 +5870,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) return true; } - bool _BBS_3MF_Exporter::_add_thumbnail_file_to_archive(mz_zip_archive& archive, const ThumbnailData& thumbnail_data, const char* local_path, int index) + bool _BBS_3MF_Exporter::_add_thumbnail_file_to_archive(mz_zip_archive& archive, const ThumbnailData& thumbnail_data, const char* local_path, int index, bool generate_small_thumbnail) { bool res = false; @@ -5860,6 +5887,49 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format(", Unable to add thumbnail file to archive\n"); } + if (generate_small_thumbnail && thumbnail_data.is_valid()) { + //generate small size of thumbnail + std::vector small_pixels; + small_pixels.resize(PLATE_THUMBNAIL_SMALL_WIDTH * PLATE_THUMBNAIL_SMALL_HEIGHT * 4); + /* step width and step height */ + int sw = thumbnail_data.width / PLATE_THUMBNAIL_SMALL_WIDTH; + int sh = thumbnail_data.height / PLATE_THUMBNAIL_SMALL_HEIGHT; + for (int i = 0; i < thumbnail_data.height; i += sh) { + for (int j = 0; j < thumbnail_data.width; j += sw) { + int r = 0, g = 0, b = 0, a = 0; + for (int m = 0; m < sh; m++) { + for (int n = 0; n < sw; n++) { + r += (int)thumbnail_data.pixels[4 * ((i + m) * thumbnail_data.width + j + n) + 0]; + g += (int)thumbnail_data.pixels[4 * ((i + m) * thumbnail_data.width + j + n) + 1]; + b += (int)thumbnail_data.pixels[4 * ((i + m) * thumbnail_data.width + j + n) + 2]; + a += (int)thumbnail_data.pixels[4 * ((i + m) * thumbnail_data.width + j + n) + 3]; + } + } + r = std::clamp(0, r / sw / sh, 255); + g = std::clamp(0, g / sw / sh, 255); + b = std::clamp(0, b / sw / sh, 255); + a = std::clamp(0, a / sw / sh, 255); + small_pixels[4 * (i / sw * PLATE_THUMBNAIL_SMALL_WIDTH + j / sh) + 0] = (unsigned char)r; + small_pixels[4 * (i / sw * PLATE_THUMBNAIL_SMALL_WIDTH + j / sh) + 1] = (unsigned char)g; + small_pixels[4 * (i / sw * PLATE_THUMBNAIL_SMALL_WIDTH + j / sh) + 2] = (unsigned char)b; + small_pixels[4 * (i / sw * PLATE_THUMBNAIL_SMALL_WIDTH + j / sh) + 3] = (unsigned char)a; + //memcpy((void*)&small_pixels[4*(i / sw * PLATE_THUMBNAIL_SMALL_WIDTH + j / sh)], thumbnail_data.pixels.data() + 4*(i * thumbnail_data.width + j), 4); + } + } + size_t small_png_size = 0; + void* small_png_data = tdefl_write_image_to_png_file_in_memory_ex((const void*)small_pixels.data(), PLATE_THUMBNAIL_SMALL_WIDTH, PLATE_THUMBNAIL_SMALL_HEIGHT, 4, &small_png_size, MZ_DEFAULT_COMPRESSION, 1); + if (png_data != nullptr) { + std::string thumbnail_name = (boost::format("%1%_%2%_small.png") % local_path % (index + 1)).str(); + res = mz_zip_writer_add_mem(&archive, thumbnail_name.c_str(), (const void*)small_png_data, small_png_size, MZ_NO_COMPRESSION); + mz_free(small_png_data); + } + + if (!res) { + add_error("Unable to add small thumbnail file to archive"); + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":" << __LINE__ << boost::format(", Unable to add small thumbnail file to archive\n"); + } + } + return res; } @@ -5909,27 +5979,46 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) if (from.empty()) { stream << " \n"; - if (data._3mf_thumbnail.empty()) { - if (export_plate_idx < 0) { - stream << " \n"; + if (export_plate_idx < 0) { + //use cover image if have + if (data._3mf_thumbnail.empty()) { + stream << " \n"; } else { - std::string thumbnail_file_str = (boost::format("Metadata/plate_%1%.png") % (export_plate_idx + 1)).str(); - stream << " \n"; + stream << " \n"; } - } else { - stream << " \n"; - } - if (!data._3mf_printer_thumbnail_middle.empty()) { - stream << " \n"; + if (data._3mf_printer_thumbnail_middle.empty()) { + stream << " \n"; + } else { + stream << " \n"; + } + + if (data._3mf_printer_thumbnail_small.empty()) { + stream << "\n"; + } else { + stream << " \n"; + } + } + else { + //always use plate thumbnails + std::string thumbnail_file_str = (boost::format("Metadata/plate_%1%.png") % (export_plate_idx + 1)).str(); + stream << " \n"; + + thumbnail_file_str = (boost::format("Metadata/plate_%1%.png") % (export_plate_idx + 1)).str(); + stream << " \n"; + + thumbnail_file_str = (boost::format("Metadata/plate_%1%_small.png") % (export_plate_idx + 1)).str(); + stream << " \n"; } - if (!data._3mf_printer_thumbnail_small.empty()) - stream << " \n"; } else if (targets.empty()) { return false; @@ -6059,7 +6148,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) metadata_item_map[BBL_DESIGNER_USER_ID_TAG] = user_id; metadata_item_map[BBL_DESIGNER_COVER_FILE_TAG] = xml_escape(design_cover); metadata_item_map[BBL_DESCRIPTION_TAG] = xml_escape(description); - metadata_item_map[BBL_COPYRIGHT_TAG] = xml_escape(copyright); + metadata_item_map[BBL_COPYRIGHT_NORMATIVE_TAG] = xml_escape(copyright); metadata_item_map[BBL_LICENSE_TAG] = xml_escape(license); /* save model info */ @@ -6313,9 +6402,10 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) } //add the transform of the volume if (ppath->empty()) - stream << " <" << COMPONENT_TAG << " objectid=\"" << volume_id; // << "\"/>\n"; + stream << " <" << COMPONENT_TAG << " objectid=\"" << volume_id; else stream << " <" << COMPONENT_TAG << " p:path=\"" << xml_escape(*ppath) << "\" objectid=\"" << volume_id; // << "\"/>\n"; + stream << "\" " << PUUID_ATTR << "=\"" << hex_wrap{(boost::uint32_t) object_data.backup_id} << COMPONENT_UUID_SUFFIX; const Transform3d &transf = volume->get_matrix(); stream << "\" " << TRANSFORM_ATTR << "=\""; for (unsigned c = 0; c < 4; ++c) { @@ -6437,17 +6527,17 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) output_buffer += OBJECT_TAG; output_buffer += " id=\""; output_buffer += std::to_string(volume_id); - /*if (m_production_ext) { + if (m_production_ext) { std::stringstream stream; reset_stream(stream); - stream << "\" " << PUUID_ATTR << "=\"" << hex_wrap{(boost::uint32_t)backup_id} << OBJECT_UUID_SUFFIX; + stream << "\" " << PUUID_ATTR << "=\"" << hex_wrap{(boost::uint32_t) object_data.backup_id} << SUB_OBJECT_UUID_SUFFIX; //output_buffer += "\" "; //output_buffer += PUUID_ATTR; //output_buffer += "=\""; //output_buffer += std::to_string(hex_wrap{(boost::uint32_t)backup_id}); //output_buffer += OBJECT_UUID_SUFFIX; output_buffer += stream.str(); - }*/ + } output_buffer += "\" type=\""; output_buffer += type; output_buffer += "\">\n"; @@ -6580,6 +6670,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) { // This happens for empty projects if (build_items.size() == 0) { + stream << " <" << BUILD_TAG << "/>\n"; return true; } @@ -6621,12 +6712,12 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) ++count; const std::vector& layer_height_profile = object->layer_height_profile.get(); if (layer_height_profile.size() >= 4 && layer_height_profile.size() % 2 == 0) { - sprintf(buffer, "object_id=%d|", count); + snprintf(buffer, 1024, "object_id=%d|", count); out += buffer; // Store the layer height profile as a single semicolon separated list. for (size_t i = 0; i < layer_height_profile.size(); ++i) { - sprintf(buffer, (i == 0) ? "%f" : ";%f", layer_height_profile[i]); + snprintf(buffer, 1024, (i == 0) ? "%f" : ";%f", layer_height_profile[i]); out += buffer; } @@ -6797,7 +6888,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) { assert(is_decimal_separator_point()); char buffer[1024]; - sprintf(buffer, "; %s\n\n", header_slic3r_generated().c_str()); + snprintf(buffer, 1024, "; %s\n\n", header_slic3r_generated().c_str()); std::string out = buffer; for (const std::string &key : config.keys()) @@ -6828,7 +6919,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) bool _BBS_3MF_Exporter::_add_project_embedded_presets_to_archive(mz_zip_archive& archive, Model& model, std::vector project_presets) { char buffer[1024]; - sprintf(buffer, "; %s\n\n", header_slic3r_generated().c_str()); + snprintf(buffer, 1024, "; %s\n\n", header_slic3r_generated().c_str()); std::string out = buffer; int print_count = 0, filament_count = 0, printer_count = 0; const std::string& temp_path = model.get_backup_path(); @@ -7235,7 +7326,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) return true; } - bool _BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, const ObjectToObjectDataMap &objects_data) + bool _BBS_3MF_Exporter::_add_slice_info_config_file_to_archive(mz_zip_archive& archive, const Model& model, PlateDataPtrs& plate_data_list, const ObjectToObjectDataMap &objects_data, const DynamicPrintConfig& config) { std::stringstream stream; // Store mesh transformation in full precision, as the volumes are stored transformed and they need to be transformed back @@ -7260,6 +7351,16 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) stream << " <" << PLATE_TAG << ">\n"; //plate index stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << PLATE_IDX_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->plate_index + 1 << "\"/>\n"; + + int timelapse_type = int(config.opt_enum("timelapse_type")); + for (auto it = plate_data->warnings.begin(); it != plate_data->warnings.end(); it++) { + if (it->msg == NOT_GENERATE_TIMELAPSE) { + timelapse_type = -1; + break; + } + } + stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << TIMELAPSE_TYPE_ATTR << "\" " << VALUE_ATTR << "=\"" << timelapse_type << "\"/>\n"; + //stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << TIMELAPSE_ERROR_CODE_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->timelapse_warning_code << "\"/>\n"; stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SLICE_PREDICTION_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->get_gcode_prediction_str() << "\"/>\n"; stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SLICE_WEIGHT_ATTR << "\" " << VALUE_ATTR << "=\"" << plate_data->get_gcode_weight_str() << "\"/>\n"; stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << OUTSIDE_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha<< plate_data->toolpath_outside << "\"/>\n"; diff --git a/src/libslic3r/Format/bbs_3mf.hpp b/src/libslic3r/Format/bbs_3mf.hpp index 8b8a53a71..ed7e440c9 100644 --- a/src/libslic3r/Format/bbs_3mf.hpp +++ b/src/libslic3r/Format/bbs_3mf.hpp @@ -14,6 +14,10 @@ class Preset; struct FilamentInfo; struct ThumbnailData; + +#define PLATE_THUMBNAIL_SMALL_WIDTH 128 +#define PLATE_THUMBNAIL_SMALL_HEIGHT 128 + #define GCODE_FILE_FORMAT "Metadata/plate_%1%.gcode" #define THUMBNAIL_FILE_FORMAT "Metadata/plate_%1%.png" #define TOP_FILE_FORMAT "Metadata/top_%1%.png" @@ -84,6 +88,7 @@ struct PlateData bool is_sliced_valid = false; bool toolpath_outside {false}; bool is_label_object_enabled {false}; + int timelapse_warning_code = 0; // 1<<0 sprial vase, 1<<1 by object std::vector warnings; diff --git a/src/libslic3r/Format/svg.cpp b/src/libslic3r/Format/svg.cpp index edca80e77..4a96274b9 100644 --- a/src/libslic3r/Format/svg.cpp +++ b/src/libslic3r/Format/svg.cpp @@ -190,6 +190,10 @@ bool get_svg_profile(const char *path, std::vector &element_infos, profile_line_points.push_back({pt1, pt2}); } } + + if (profile_line_points.empty()) + continue; + // keep the start and end points of profile connected if (shape->fill.gradient != nullptr) profile_line_points.back().second = profile_line_points[0].first; @@ -269,6 +273,9 @@ bool get_svg_profile(const char *path, std::vector &element_infos, wires.emplace_back(wire); } + if (wires.empty()) + continue; + gp_Vec dir(0, 0, 10); BRepBuilderAPI_MakeFace face_make(wires[index]); for (int i = 0; i < wires.size(); ++i) { diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index db46eb534..89c47c321 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -980,6 +980,33 @@ static std::vector get_path_of_change_filament(const Print& print) return gcode; } + bool WipeTowerIntegration::is_empty_wipe_tower_gcode(GCode &gcodegen, int extruder_id, bool finish_layer) + { + assert(m_layer_idx >= 0); + if (m_layer_idx >= (int) m_tool_changes.size()) + return true; + + bool ignore_sparse = false; + if (gcodegen.config().wipe_tower_no_sparse_layers.value) { + ignore_sparse = (m_tool_changes[m_layer_idx].size() == 1 && m_tool_changes[m_layer_idx].front().initial_tool == m_tool_changes[m_layer_idx].front().new_tool); + } + + if (m_enable_timelapse_print && m_is_first_print) { + return false; + } + + if (gcodegen.writer().need_toolchange(extruder_id) || finish_layer) { + if (!(size_t(m_tool_change_idx) < m_tool_changes[m_layer_idx].size())) + throw Slic3r::RuntimeError("Wipe tower generation failed, possibly due to empty first layer."); + + if (!ignore_sparse) { + return false; + } + } + + return true; + } + // Print is finished. Now it remains to unload the filament safely with ramming over the wipe tower. std::string WipeTowerIntegration::finalize(GCode &gcodegen) { @@ -1364,6 +1391,7 @@ namespace DoExport { if (ret.size() < MAX_TAGS_COUNT) check(_(L("Machine end G-code")), config.machine_end_gcode.value); if (ret.size() < MAX_TAGS_COUNT) check(_(L("Before layer change G-code")), config.before_layer_change_gcode.value); if (ret.size() < MAX_TAGS_COUNT) check(_(L("Layer change G-code")), config.layer_change_gcode.value); + if (ret.size() < MAX_TAGS_COUNT) check(_(L("Time lapse G-code")), config.time_lapse_gcode.value); if (ret.size() < MAX_TAGS_COUNT) check(_(L("Change filament G-code")), config.change_filament_gcode.value); //BBS //if (ret.size() < MAX_TAGS_COUNT) check(_(L("Printing by object G-code")), config.printing_by_object_gcode.value); @@ -1486,6 +1514,16 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu BOOST_LOG_TRIVIAL(debug) << "Start processing gcode, " << log_memory_info(); // Post-process the G-code to update time stamps. + + m_timelapse_warning_code = 0; + if (m_config.printer_structure.value == PrinterStructure::psI3 && m_spiral_vase) { + m_timelapse_warning_code += 1; + } + if (m_config.printer_structure.value == PrinterStructure::psI3 && print->config().print_sequence == PrintSequence::ByObject) { + m_timelapse_warning_code += (1 << 1); + } + m_processor.result().timelapse_warning_code = m_timelapse_warning_code; + m_processor.result().support_traditional_timelapse = m_support_traditional_timelapse; m_processor.finalize(true); // DoExport::update_print_estimated_times_stats(m_processor, print->m_print_statistics); DoExport::update_print_estimated_stats(m_processor, m_writer.extruders(), print->m_print_statistics); @@ -1648,16 +1686,13 @@ namespace DoExport { output((boost::format("; thumbnail begin %dx%d %d\n") % data.width % data.height % encoded.size()).str().c_str()); unsigned int row_count = 0; - while (encoded.size() > max_row_length) - { - output((boost::format("; %s\n") % encoded.substr(0, max_row_length)).str().c_str()); - encoded = encoded.substr(max_row_length); + //BBS: optimize performance ,reduce too much memeory operation + size_t current_index = 0; + while(current_index 0) - output((boost::format("; %s\n") % encoded).str().c_str()); - output("; thumbnail end\n"); output("; THUMBNAIL_BLOCK_END\n\n"); @@ -1946,7 +1981,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato [&print]() { print.throw_if_canceled(); }); } } - + // Write some terse information on the slicing parameters. const PrintObject *first_object = print.objects().front(); @@ -2246,8 +2281,12 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato file.writeln(this->placeholder_parser_process("filament_start_gcode", print.config().filament_start_gcode.values[initial_extruder_id], initial_extruder_id, &config)); } */ - if (is_bbl_printers) + if (is_bbl_printers) { this->_print_first_layer_extruder_temperatures(file, print, machine_start_gcode, initial_extruder_id, true); + if (m_config.support_air_filtration.getBool() && m_config.activate_air_filtration.get_at(initial_extruder_id)) { + file.write(m_writer.set_exhaust_fan(m_config.during_print_exhaust_fan_speed.get_at(initial_extruder_id), true)); + } + } print.throw_if_canceled(); // Set other general things. @@ -2518,6 +2557,9 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato file.write(m_writer.update_progress(m_layer_count, m_layer_count, true)); // 100% file.write(m_writer.postamble()); + file.write(m_writer.set_chamber_temperature(0, false)); //close chamber_temperature + + // adds tags for time estimators file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Last_Line_M73_Placeholder).c_str()); file.write_format("; EXECUTABLE_BLOCK_END\n\n"); @@ -2567,6 +2609,19 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato } file.write("\n"); + bool activate_air_filtration = false; + for (const auto& extruder : m_writer.extruders()) + activate_air_filtration |= m_config.activate_air_filtration.get_at(extruder.id()); + activate_air_filtration &= m_config.support_air_filtration.getBool(); + + if (activate_air_filtration) { + int complete_print_exhaust_fan_speed = 0; + for (const auto& extruder : m_writer.extruders()) + if (m_config.activate_air_filtration.get_at(extruder.id())) + complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(extruder.id())); + file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true)); + } + print.throw_if_canceled(); } @@ -2885,6 +2940,7 @@ int GCode::get_bed_temperature(const int extruder_id, const bool is_first_layer, return bed_temp_opt->get_at(extruder_id); } + // Write 1st layer bed temperatures into the G-code. // Only do that if the start G-code does not already contain any M-code controlling an extruder temperature. // M140 - Set Extruder Temperature @@ -3320,10 +3376,45 @@ GCode::LayerResult GCode::process_layer( + "\n"; } + PrinterStructure printer_structure = m_config.printer_structure.value; + bool need_insert_timelapse_gcode_for_traditional = false; + if (printer_structure == PrinterStructure::psI3 && + !m_spiral_vase && + (!m_wipe_tower || !m_wipe_tower->enable_timelapse_print()) && + print.config().print_sequence == PrintSequence::ByLayer) { + need_insert_timelapse_gcode_for_traditional = true; + } + bool has_insert_timelapse_gcode = false; + bool has_wipe_tower = (layer_tools.has_wipe_tower && m_wipe_tower); + + auto insert_timelapse_gcode = [this, print_z, &print]() -> std::string { + std::string gcode_res; + if (!print.config().time_lapse_gcode.value.empty()) { + DynamicConfig config; + config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); + config.set_key_value("layer_z", new ConfigOptionFloat(print_z)); + config.set_key_value("max_layer_z", new ConfigOptionFloat(m_max_layer_z)); + gcode_res = this->placeholder_parser_process("timelapse_gcode", print.config().time_lapse_gcode.value, m_writer.extruder()->id(), &config) + "\n"; + } + return gcode_res; + }; + // BBS: don't use lazy_raise when enable spiral vase gcode += this->change_layer(print_z); // this will increase m_layer_index m_layer = &layer; m_object_layer_over_raft = false; + if (printer_structure == PrinterStructure::psI3 && !need_insert_timelapse_gcode_for_traditional && !m_spiral_vase && print.config().print_sequence == PrintSequence::ByLayer) { + std::string timepals_gcode = insert_timelapse_gcode(); + gcode += timepals_gcode; + m_writer.set_current_position_clear(false); + //BBS: check whether custom gcode changes the z position. Update if changed + double temp_z_after_timepals_gcode; + if (GCodeProcessor::get_last_z_from_gcode(timepals_gcode, temp_z_after_timepals_gcode)) { + Vec3d pos = m_writer.get_position(); + pos(2) = temp_z_after_timepals_gcode; + m_writer.set_position(pos); + } + } if (! print.config().layer_change_gcode.value.empty()) { DynamicConfig config; config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index)); @@ -3633,9 +3724,29 @@ GCode::LayerResult GCode::process_layer( // Extrude the skirt, brim, support, perimeters, infill ordered by the extruders. for (unsigned int extruder_id : layer_tools.extruders) { - gcode += (layer_tools.has_wipe_tower && m_wipe_tower) ? - m_wipe_tower->tool_change(*this, extruder_id, extruder_id == layer_tools.extruders.back()) : - this->set_extruder(extruder_id, print_z); + if (has_wipe_tower) { + if (!m_wipe_tower->is_empty_wipe_tower_gcode(*this, extruder_id, extruder_id == layer_tools.extruders.back())) { + if (need_insert_timelapse_gcode_for_traditional && !has_insert_timelapse_gcode) { + gcode += this->retract(false, false, LiftType::NormalLift); + m_writer.add_object_change_labels(gcode); + + std::string timepals_gcode = insert_timelapse_gcode(); + gcode += timepals_gcode; + m_writer.set_current_position_clear(false); + //BBS: check whether custom gcode changes the z position. Update if changed + double temp_z_after_timepals_gcode; + if (GCodeProcessor::get_last_z_from_gcode(timepals_gcode, temp_z_after_timepals_gcode)) { + Vec3d pos = m_writer.get_position(); + pos(2) = temp_z_after_timepals_gcode; + m_writer.set_position(pos); + } + has_insert_timelapse_gcode = true; + } + gcode += m_wipe_tower->tool_change(*this, extruder_id, extruder_id == layer_tools.extruders.back()); + } + } else { + gcode += this->set_extruder(extruder_id, print_z); + } // let analyzer tag generator aware of a role type change if (layer_tools.has_wipe_tower && m_wipe_tower) @@ -3829,11 +3940,11 @@ GCode::LayerResult GCode::process_layer( //BBS: for first layer, we always print wall firstly to get better bed adhesive force //This behaviour is same with cura if (is_infill_first && !first_layer) { - gcode += this->extrude_infill(print, by_region_specific, false); + gcode += this->extrude_infill(print, by_region_specific, false); gcode += this->extrude_perimeters(print, by_region_specific); } else { gcode += this->extrude_perimeters(print, by_region_specific); - gcode += this->extrude_infill(print,by_region_specific, false); + gcode += this->extrude_infill(print,by_region_specific, false); } // ironing gcode += this->extrude_infill(print,by_region_specific, true); @@ -3892,6 +4003,25 @@ GCode::LayerResult GCode::process_layer( BOOST_LOG_TRIVIAL(trace) << "Exported layer " << layer.id() << " print_z " << print_z << log_memory_info(); + if (!has_wipe_tower && need_insert_timelapse_gcode_for_traditional && !has_insert_timelapse_gcode) { + if (m_support_traditional_timelapse) + m_support_traditional_timelapse = false; + + gcode += this->retract(false, false, LiftType::NormalLift); + m_writer.add_object_change_labels(gcode); + + std::string timepals_gcode = insert_timelapse_gcode(); + gcode += timepals_gcode; + m_writer.set_current_position_clear(false); + //BBS: check whether custom gcode changes the z position. Update if changed + double temp_z_after_timepals_gcode; + if (GCodeProcessor::get_last_z_from_gcode(timepals_gcode, temp_z_after_timepals_gcode)) { + Vec3d pos = m_writer.get_position(); + pos(2) = temp_z_after_timepals_gcode; + m_writer.set_position(pos); + } + } + result.gcode = std::move(gcode); result.cooling_buffer_flush = object_layer || raft_layer || last_layer; return result; diff --git a/src/libslic3r/GCode.hpp b/src/libslic3r/GCode.hpp index c604d200e..78c106d51 100644 --- a/src/libslic3r/GCode.hpp +++ b/src/libslic3r/GCode.hpp @@ -93,6 +93,7 @@ public: std::string prime(GCode &gcodegen); void next_layer() { ++ m_layer_idx; m_tool_change_idx = 0; } std::string tool_change(GCode &gcodegen, int extruder_id, bool finish_layer); + bool is_empty_wipe_tower_gcode(GCode &gcodegen, int extruder_id, bool finish_layer); std::string finalize(GCode &gcodegen); std::vector used_filament_length() const; @@ -525,6 +526,9 @@ private: // Index of a last object copy extruded. std::pair m_last_obj_copy; + int m_timelapse_warning_code = 0; + bool m_support_traditional_timelapse = true; + bool m_silent_time_estimator_enabled; // Processor diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp index 7a27587ea..e776a5fbb 100644 --- a/src/libslic3r/GCode/GCodeProcessor.cpp +++ b/src/libslic3r/GCode/GCodeProcessor.cpp @@ -59,7 +59,8 @@ const std::vector GCodeProcessor::Reserved_Tags = { "_GP_FIRST_LINE_M73_PLACEHOLDER", "_GP_LAST_LINE_M73_PLACEHOLDER", "_GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER", - "_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER" + "_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER", + "_DURING_PRINT_EXHAUST_FAN" }; const std::vector GCodeProcessor::Reserved_Tags_compatible = { @@ -383,6 +384,8 @@ void GCodeProcessor::TimeProcessor::reset() machine_limits = MachineEnvelopeConfig(); filament_load_times = 0.0f; filament_unload_times = 0.0f; + + for (size_t i = 0; i < static_cast(PrintEstimatedStatistics::ETimeMode::Count); ++i) { machines[i].reset(); } @@ -427,6 +430,14 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st return std::string(line_M73); }; + auto format_line_exhaust_fan_control = [](const std::string& mask,int fan_index,int percent) { + char line_fan[64] = { 0 }; + sprintf(line_fan,mask.c_str(), + std::to_string(fan_index).c_str(), + std::to_string(int((percent/100.0)*255)).c_str()); + return std::string(line_fan); + }; + auto format_time_float = [](float time) { return Slic3r::float_to_string_decimal_point(time, 2); }; @@ -542,7 +553,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st // add lines M73 to exported gcode auto process_line_move = [ // Lambdas, mostly for string formatting, all with an empty capture block. - time_in_minutes, format_time_float, format_line_M73_main, format_line_M73_stop_int, format_line_M73_stop_float, time_in_last_minute, + time_in_minutes, format_time_float, format_line_M73_main, format_line_M73_stop_int, format_line_M73_stop_float, time_in_last_minute,format_line_exhaust_fan_control, &self = std::as_const(*this), // Caches, to be modified &g1_times_cache_it, &last_exported_main, &last_exported_stop, @@ -561,6 +572,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st if (it != machine.g1_times_cache.end() && it->id == g1_lines_counter) { std::pair to_export_main = { int(100.0f * it->elapsed_time / machine.time), time_in_minutes(machine.time - it->elapsed_time) }; + if (last_exported_main[i] != to_export_main) { export_line += format_line_M73_main(machine.line_m73_main_mask.c_str(), to_export_main.first, to_export_main.second); @@ -802,6 +814,7 @@ void GCodeProcessorResult::reset() { toolpath_outside = false; //BBS: add label_object_enabled label_object_enabled = false; + timelapse_warning_code = 0; printable_height = 0.0f; settings_ids.reset(); extruders_count = 0; @@ -829,6 +842,7 @@ void GCodeProcessorResult::reset() { toolpath_outside = false; //BBS: add label_object_enabled label_object_enabled = false; + timelapse_warning_code = 0; printable_height = 0.0f; settings_ids.reset(); extruders_count = 0; @@ -998,6 +1012,8 @@ void GCodeProcessor::apply_config(const PrintConfig& config) const ConfigOptionBool* spiral_vase = config.option("spiral_mode"); if (spiral_vase != nullptr) m_spiral_vase_active = spiral_vase->value; + + } void GCodeProcessor::apply_config(const DynamicPrintConfig& config) @@ -1498,9 +1514,9 @@ void GCodeProcessor::finalize(bool post_process) m_height_compare.output(); m_width_compare.output(); #endif // ENABLE_GCODE_VIEWER_DATA_CHECKING - - if (post_process) + if (post_process){ m_time_processor.post_process(m_result.filename, m_result.moves, m_result.lines_ends, m_layer_id); + } #if ENABLE_GCODE_VIEWER_STATISTICS m_result.time = std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - m_start_time).count(); #endif // ENABLE_GCODE_VIEWER_STATISTICS @@ -1817,6 +1833,7 @@ void GCodeProcessor::process_gcode_line(const GCodeReader::GCodeLine& line, bool case '9': switch (cmd[3]) { case '0': { process_M190(line); break; } // Wait bed temperature + case '1': { process_M191(line); break; } // Wait chamber temperature default: break; } default: @@ -1935,7 +1952,7 @@ template // Legacy conversion, which is costly due to having to make a copy of the string before conversion. try { assert(sv.size() < 1024); - assert(sv.data() != nullptr); + assert(sv.data() != nullptr); std::string str { sv }; size_t read = 0; if constexpr (std::is_same_v) @@ -3751,6 +3768,15 @@ void GCodeProcessor::process_M190(const GCodeReader::GCodeLine& line) m_highest_bed_temp = m_highest_bed_temp < (int)new_temp ? (int)new_temp : m_highest_bed_temp; } +void GCodeProcessor::process_M191(const GCodeReader::GCodeLine& line) +{ + float chamber_temp = 0; + const float wait_chamber_temp_time = 720.0; + // BBS: when chamber_temp>40,caculate time required for heating + if (line.has_value('S', chamber_temp) && chamber_temp > 40) + simulate_st_synchronize(wait_chamber_temp_time); +} + void GCodeProcessor::process_M201(const GCodeReader::GCodeLine& line) { @@ -4355,6 +4381,29 @@ void GCodeProcessor::update_slice_warnings() m_result.warnings.push_back(warning); } + // bbs:HRC checker + warning.params.clear(); + warning.level = 1; + if (!m_result.support_traditional_timelapse) { + warning.msg = NOT_SUPPORT_TRADITIONAL_TIMELAPSE; + warning.error_code = "1000C003"; + m_result.warnings.push_back(warning); + } + + if (m_result.timelapse_warning_code != 0) { + if (m_result.timelapse_warning_code & 1) { + warning.msg = NOT_GENERATE_TIMELAPSE; + warning.error_code = "1001C001"; + m_result.warnings.push_back(warning); + } + + if ((m_result.timelapse_warning_code >> 1) & 1) { + warning.msg = NOT_GENERATE_TIMELAPSE; + warning.error_code = "1001C002"; + m_result.warnings.push_back(warning); + } + } + m_result.warnings.shrink_to_fit(); } diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index f78ddd350..84240714a 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -20,6 +20,8 @@ namespace Slic3r { // slice warnings enum strings #define NOZZLE_HRC_CHECKER "the_actual_nozzle_hrc_smaller_than_the_required_nozzle_hrc" #define BED_TEMP_TOO_HIGH_THAN_FILAMENT "bed_temperature_too_high_than_filament" +#define NOT_SUPPORT_TRADITIONAL_TIMELAPSE "not_support_traditional_timelapse" +#define NOT_GENERATE_TIMELAPSE "not_generate_timelapse" enum class EMoveType : unsigned char { @@ -179,6 +181,8 @@ namespace Slic3r { bool toolpath_outside; //BBS: add object_label_enabled bool label_object_enabled; + int timelapse_warning_code {0}; + bool support_traditional_timelapse{true}; float printable_height; SettingsIds settings_ids; size_t extruders_count; @@ -212,6 +216,7 @@ namespace Slic3r { bed_exclude_area = other.bed_exclude_area; toolpath_outside = other.toolpath_outside; label_object_enabled = other.label_object_enabled; + timelapse_warning_code = other.timelapse_warning_code; printable_height = other.printable_height; settings_ids = other.settings_ids; extruders_count = other.extruders_count; @@ -255,7 +260,8 @@ namespace Slic3r { First_Line_M73_Placeholder, Last_Line_M73_Placeholder, Estimated_Printing_Time_Placeholder, - Total_Layer_Number_Placeholder + Total_Layer_Number_Placeholder, + During_Print_Exhaust_Fan }; static const std::string& reserved_tag(ETags tag) { return s_IsBBLPrinter ? Reserved_Tags[static_cast(tag)] : Reserved_Tags_compatible[static_cast(tag)]; } @@ -357,6 +363,7 @@ namespace Slic3r { float time() const; }; + private: struct TimeMachine { @@ -452,6 +459,7 @@ namespace Slic3r { // Additional load / unload times for a filament exchange sequence. float filament_load_times; float filament_unload_times; + std::array(PrintEstimatedStatistics::ETimeMode::Count)> machines; void reset(); @@ -617,7 +625,6 @@ namespace Slic3r { private: GCodeReader m_parser; - EUnits m_units; EPositioningType m_global_positioning_type; EPositioningType m_e_local_positioning_type; @@ -711,6 +718,7 @@ namespace Slic3r { void reset(); const GCodeProcessorResult& get_result() const { return m_result; } + GCodeProcessorResult& result() { return m_result; } GCodeProcessorResult&& extract_result() { return std::move(m_result); } // Load a G-code into a stand-alone G-code viewer. @@ -829,6 +837,9 @@ namespace Slic3r { //BBS: wait bed temperature void process_M190(const GCodeReader::GCodeLine& line); + //BBS: wait chamber temperature + void process_M191(const GCodeReader::GCodeLine& line); + // Set max printing acceleration void process_M201(const GCodeReader::GCodeLine& line); diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index f282db606..e3e619f9e 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -157,6 +157,25 @@ std::string GCodeWriter::set_bed_temperature(int temperature, bool wait) return gcode.str(); } +std::string GCodeWriter::set_chamber_temperature(int temperature, bool wait) +{ + std::string code, comment; + std::ostringstream gcode; + + if (wait) + { + gcode<<"M106 P2 S255 \n"; + gcode<<"M191 S"<get_assemble_transformation().get_matrix(); const Transform3d &instance_inverse_matrix = instance_transformation_copy.get_matrix().inverse(); Transform3d new_instance_inverse_matrix = instance_inverse_matrix * obj_instance->get_transformation().get_matrix(true).inverse(); + if (place_on_cut) { // reset the rotation of cut plane + new_instance_inverse_matrix = new_instance_inverse_matrix * Transformation(cut_matrix).get_matrix(true, false, true, true).inverse(); + } Transform3d new_assemble_transform = assemble_matrix * new_instance_inverse_matrix; obj_instance->set_assemble_from_transform(new_assemble_transform); } @@ -2097,7 +2117,7 @@ ModelObjectPtrs ModelObject::cut(size_t instance, std::array plane_poi // Displacement (in instance coordinates) to be applied to place the upper parts Vec3d local_displace = Vec3d::Zero(); Vec3d local_dowels_displace = Vec3d::Zero(); - + for (ModelVolume *volume : volumes) { const auto volume_matrix = volume->get_matrix(); @@ -2122,7 +2142,7 @@ ModelObjectPtrs ModelObject::cut(size_t instance, std::array plane_poi } ModelObjectPtrs res; - + if (attributes.has(ModelObjectCutAttribute::CutToParts) && !upper->volumes.empty()) { reset_instance_transformation(upper, instance, cut_matrix); res.push_back(upper); @@ -2356,7 +2376,7 @@ void ModelObject::split(ModelObjectPtrs* new_objects) { Vec3d shift = model_instance->get_transformation().get_matrix(true) * new_vol->get_offset(); model_instance->set_offset(model_instance->get_offset() + shift); - + //BBS: add assemble_view related logic Geometry::Transformation instance_transformation_copy = model_instance->get_transformation(); instance_transformation_copy.set_offset(-new_vol->get_offset()); @@ -2365,6 +2385,7 @@ void ModelObject::split(ModelObjectPtrs* new_objects) Transform3d new_instance_inverse_matrix = instance_inverse_matrix * model_instance->get_transformation().get_matrix(true).inverse(); Transform3d new_assemble_transform = assemble_matrix * new_instance_inverse_matrix; model_instance->set_assemble_from_transform(new_assemble_transform); + model_instance->set_offset_to_assembly(new_vol->get_offset()); } new_vol->set_offset(Vec3d::Zero()); @@ -3234,6 +3255,91 @@ void ModelInstance::transform_polygon(Polygon* polygon) const } //BBS +// BBS set print speed table and find maximum speed +void Model::setPrintSpeedTable(const DynamicPrintConfig& config, const PrintConfig& print_config) { + //Slic3r::DynamicPrintConfig config = wxGetApp().preset_bundle->full_config(); + printSpeedMap.maxSpeed = 0; + if (config.has("inner_wall_speed")) { + printSpeedMap.perimeterSpeed = config.opt_float("inner_wall_speed"); + if (printSpeedMap.perimeterSpeed > printSpeedMap.maxSpeed) + printSpeedMap.maxSpeed = printSpeedMap.perimeterSpeed; + } + if (config.has("outer_wall_speed")) { + printSpeedMap.externalPerimeterSpeed = config.opt_float("outer_wall_speed"); + printSpeedMap.maxSpeed = std::max(printSpeedMap.maxSpeed, printSpeedMap.externalPerimeterSpeed); + } + if (config.has("sparse_infill_speed")) { + printSpeedMap.infillSpeed = config.opt_float("sparse_infill_speed"); + if (printSpeedMap.infillSpeed > printSpeedMap.maxSpeed) + printSpeedMap.maxSpeed = printSpeedMap.infillSpeed; + } + if (config.has("internal_solid_infill_speed")) { + printSpeedMap.solidInfillSpeed = config.opt_float("internal_solid_infill_speed"); + if (printSpeedMap.solidInfillSpeed > printSpeedMap.maxSpeed) + printSpeedMap.maxSpeed = printSpeedMap.solidInfillSpeed; + } + if (config.has("top_surface_speed")) { + printSpeedMap.topSolidInfillSpeed = config.opt_float("top_surface_speed"); + if (printSpeedMap.topSolidInfillSpeed > printSpeedMap.maxSpeed) + printSpeedMap.maxSpeed = printSpeedMap.topSolidInfillSpeed; + } + if (config.has("support_speed")) { + printSpeedMap.supportSpeed = config.opt_float("support_speed"); + + if (printSpeedMap.supportSpeed > printSpeedMap.maxSpeed) + printSpeedMap.maxSpeed = printSpeedMap.supportSpeed; + } + + + //auto& print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); + //auto print_config = print.config(); + //printSpeedMap.bed_poly.points = get_bed_shape(*(wxGetApp().plater()->config())); + printSpeedMap.bed_poly.points = get_bed_shape(config); + Pointfs excluse_area_points = print_config.bed_exclude_area.values; + Polygons exclude_polys; + Polygon exclude_poly; + for (int i = 0; i < excluse_area_points.size(); i++) { + auto pt = excluse_area_points[i]; + exclude_poly.points.emplace_back(scale_(pt.x()), scale_(pt.y())); + if (i % 4 == 3) { // exclude areas are always rectangle + exclude_polys.push_back(exclude_poly); + exclude_poly.points.clear(); + } + } + printSpeedMap.bed_poly = diff({ printSpeedMap.bed_poly }, exclude_polys)[0]; +} + +// find temperature of heatend and bed and matierial of an given extruder +void Model::setExtruderParams(const DynamicPrintConfig& config, int extruders_count) { + extruderParamsMap.clear(); + //Slic3r::DynamicPrintConfig config = wxGetApp().preset_bundle->full_config(); + // BBS + //int numExtruders = wxGetApp().preset_bundle->filament_presets.size(); + for (unsigned int i = 0; i != extruders_count; ++i) { + std::string matName = ""; + // BBS + int bedTemp = 35; + double endTemp = 0.f; + if (config.has("filament_type")) { + matName = config.opt_string("filament_type", i); + } + if (config.has("nozzle_temperature")) { + endTemp = config.opt_int("nozzle_temperature", i); + } + + // FIXME: curr_bed_type is now a plate config rather than a global config. + // Currently bed temp is not used for brim generation, so just comment it for now. +#if 0 + if (config.has("curr_bed_type")) { + BedType curr_bed_type = config.opt_enum("curr_bed_type"); + bedTemp = config.opt_int(get_bed_temp_key(curr_bed_type), i); + } +#endif + if (i == 0) extruderParamsMap.insert({ i,{matName, bedTemp, endTemp} }); + extruderParamsMap.insert({ i + 1,{matName, bedTemp, endTemp} }); + } +} + // update the maxSpeed of an object if it is different from the global configuration double Model::findMaxSpeed(const ModelObject* object) { auto objectKeys = object->config.keys(); diff --git a/src/libslic3r/Model.hpp b/src/libslic3r/Model.hpp index f088b6b24..481552c05 100644 --- a/src/libslic3r/Model.hpp +++ b/src/libslic3r/Model.hpp @@ -1561,6 +1561,9 @@ public: static double getThermalLength(const ModelVolume* modelVolumePtr); static double getThermalLength(const std::vector modelVolumePtrs); static Polygon getBedPolygon() { return Model::printSpeedMap.bed_poly; } + //BBS static functions that update extruder params and speed table + static void setPrintSpeedTable(const DynamicPrintConfig& config, const PrintConfig& print_config); + static void setExtruderParams(const DynamicPrintConfig& config, int extruders_count); // BBS: backup static Model read_from_archive( diff --git a/src/libslic3r/ModelArrange.cpp b/src/libslic3r/ModelArrange.cpp index ed3f7a509..710b031fe 100644 --- a/src/libslic3r/ModelArrange.cpp +++ b/src/libslic3r/ModelArrange.cpp @@ -145,24 +145,23 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r:: // get brim width auto obj = instance->get_object(); -#if 0 - ap.brim_width = instance->get_auto_brim_width(); - auto brim_type_ptr = obj->get_config_value>(config, "brim_type"); - if (brim_type_ptr) { - auto brim_type = brim_type_ptr->getInt(); - if (brim_type == btOuterOnly) - ap.brim_width = obj->get_config_value(config, "brim_width")->getFloat(); - else if (brim_type == btNoBrim) - ap.brim_width = 0; - } -#else - ap.brim_width = 0; + + ap.brim_width = 1.0; // For by-layer printing, need to shrink bed a little, so the support won't go outside bed. // We set it to 5mm because that's how much a normal support will grow by default. + // normal support 5mm, other support 22mm, no support 0mm auto supp_type_ptr = obj->get_config_value(config, "enable_support"); - if (supp_type_ptr && supp_type_ptr->getBool()) - ap.brim_width = 5.0; -#endif + auto support_type_ptr = obj->get_config_value>(config, "support_type"); + auto support_type = support_type_ptr->value; + auto enable_support = supp_type_ptr->getBool(); + int support_int = support_type_ptr->getInt(); + + if (enable_support && (support_type == stNormalAuto || support_type == stNormal)) + ap.brim_width = 6.0; + else if (enable_support) { + ap.brim_width = 24.0; // 2*MAX_BRANCH_RADIUS_FIRST_LAYER + ap.has_tree_support = true; + } ap.height = obj->bounding_box().size().z(); ap.name = obj->name; diff --git a/src/libslic3r/Orient.cpp b/src/libslic3r/Orient.cpp index 0011898bc..a87694ad9 100644 --- a/src/libslic3r/Orient.cpp +++ b/src/libslic3r/Orient.cpp @@ -115,7 +115,7 @@ public: area_cumulation_accurate(face_normals, normals_quantize, areas, 10); - area_cumulation_accurate(face_normals_hull, normals_hull_quantize, areas_hull, 10); + area_cumulation_accurate(face_normals_hull, normals_hull_quantize, areas_hull, 14); add_supplements(); diff --git a/src/libslic3r/PNGReadWrite.cpp b/src/libslic3r/PNGReadWrite.cpp index 51bf7de7c..e4b7489b8 100644 --- a/src/libslic3r/PNGReadWrite.cpp +++ b/src/libslic3r/PNGReadWrite.cpp @@ -100,6 +100,87 @@ bool decode_png(IStream &in_buf, ImageGreyscale &out_img) return true; } +bool decode_colored_png(IStream &in_buf, ImageColorscale &out_img) +{ + static const constexpr int PNG_SIG_BYTES = 8; + + std::vector sig(PNG_SIG_BYTES, 0); + in_buf.read(sig.data(), PNG_SIG_BYTES); + if (!png_check_sig(sig.data(), PNG_SIG_BYTES)) { + BOOST_LOG_TRIVIAL(error) << boost::format("decode_colored_png: png_check_sig failed"); + return false; + } + + PNGDescr dsc; + dsc.png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, + nullptr); + + if(!dsc.png) { + BOOST_LOG_TRIVIAL(error) << boost::format("decode_colored_png: png_create_read_struct failed"); + return false; + } + + dsc.info = png_create_info_struct(dsc.png); + if(!dsc.info) { + BOOST_LOG_TRIVIAL(error) << boost::format("decode_colored_png: png_create_info_struct failed"); + png_destroy_read_struct(&dsc.png, &dsc.info, NULL); + return false; + } + + png_set_read_fn(dsc.png, static_cast(&in_buf), png_read_callback); + + // Tell that we have already read the first bytes to check the signature + png_set_sig_bytes(dsc.png, PNG_SIG_BYTES); + + png_read_info(dsc.png, dsc.info); + + out_img.cols = png_get_image_width(dsc.png, dsc.info); + out_img.rows = png_get_image_height(dsc.png, dsc.info); + size_t color_type = png_get_color_type(dsc.png, dsc.info); + size_t bit_depth = png_get_bit_depth(dsc.png, dsc.info); + unsigned long rowbytes = png_get_rowbytes(dsc.png, dsc.info); + + switch(color_type) + { + case PNG_COLOR_TYPE_RGB: + out_img.bytes_per_pixel = 3; + break; + case PNG_COLOR_TYPE_RGB_ALPHA: + out_img.bytes_per_pixel = 4; + break; + default: //not supported currently + png_destroy_read_struct(&dsc.png, &dsc.info, NULL); + return false; + } + + BOOST_LOG_TRIVIAL(info) << boost::format("png's cols %1%, rows %2%, color_type %3%, bit_depth %4%, bytes_per_pixel %5%, rowbytes %6%")%out_img.cols %out_img.rows %color_type %bit_depth %out_img.bytes_per_pixel %rowbytes; + out_img.buf.resize(out_img.rows * rowbytes); + + int filter_type = png_get_filter_type(dsc.png, dsc.info); + int compression_type = png_get_compression_type(dsc.png, dsc.info); + int interlace_type = png_get_interlace_type(dsc.png, dsc.info); + BOOST_LOG_TRIVIAL(info) << boost::format("filter_type %1%, compression_type %2%, interlace_type %3%, rowbytes %4%")%filter_type %compression_type %interlace_type %rowbytes; + + auto readbuf = static_cast(out_img.buf.data()); + for (size_t r = out_img.rows; r > 0; r--) + { + png_read_row(dsc.png, readbuf + (r - 1) * rowbytes, nullptr); + } + + png_read_end(dsc.png, dsc.info); + png_destroy_read_struct(&dsc.png, &dsc.info, NULL); + + return true; +} + +bool decode_colored_png(const ReadBuf &in_buf, ImageColorscale &out_img) +{ + struct ReadBufStream stream{in_buf}; + + return decode_colored_png(stream, out_img); +} + + // Down to earth function to store a packed RGB image to file. Mostly useful for debugging purposes. // Based on https://www.lemoda.net/c/write-png/ // png_color_type is PNG_COLOR_TYPE_RGB or PNG_COLOR_TYPE_GRAY @@ -112,7 +193,7 @@ static bool write_rgb_or_gray_to_file(const char *file_name_utf8, size_t width, png_structp png_ptr = nullptr; png_infop info_ptr = nullptr; png_byte **row_pointers = nullptr; - + FILE *fp = boost::nowide::fopen(file_name_utf8, "wb"); if (! fp) { BOOST_LOG_TRIVIAL(error) << "write_png_file: File could not be opened for writing: " << file_name_utf8; diff --git a/src/libslic3r/PNGReadWrite.hpp b/src/libslic3r/PNGReadWrite.hpp index 01e1f4745..c76d7b168 100644 --- a/src/libslic3r/PNGReadWrite.hpp +++ b/src/libslic3r/PNGReadWrite.hpp @@ -23,11 +23,19 @@ template struct Image { }; using ImageGreyscale = Image; +struct ImageColorscale:Image +{ + int bytes_per_pixel; +}; + // Only decodes true 8 bit grayscale png images. Returns false for other formats // TODO (if needed): implement transformation of rgb images into grayscale... bool decode_png(IStream &stream, ImageGreyscale &out_img); +//BBS: decode png for other format +bool decode_colored_png(IStream &in_buf, ImageColorscale &out_img); + // TODO (if needed) // struct RGB { uint8_t r, g, b; }; // using ImageRGB = Image; @@ -39,30 +47,36 @@ struct ReadBuf { const void *buf = nullptr; const size_t sz = 0; }; bool is_png(const ReadBuf &pngbuf); +struct ReadBufStream: public IStream { + const ReadBuf &rbuf_ref; + size_t pos = 0; + + explicit ReadBufStream(const ReadBuf &buf): rbuf_ref{buf} {} + + size_t read(std::uint8_t *outp, size_t amount) override + { + if (amount > rbuf_ref.sz - pos) return 0; + + auto buf = static_cast(rbuf_ref.buf); + std::copy(buf + pos, buf + (pos + amount), outp); + pos += amount; + + return amount; + } + + bool is_ok() const override { return pos < rbuf_ref.sz; } +}; + template bool decode_png(const ReadBuf &in_buf, Img &out_img) { - struct ReadBufStream: public IStream { - const ReadBuf &rbuf_ref; size_t pos = 0; - - explicit ReadBufStream(const ReadBuf &buf): rbuf_ref{buf} {} - - size_t read(std::uint8_t *outp, size_t amount) override - { - if (amount > rbuf_ref.sz - pos) return 0; - - auto buf = static_cast(rbuf_ref.buf); - std::copy(buf + pos, buf + (pos + amount), outp); - pos += amount; - - return amount; - } - - bool is_ok() const override { return pos < rbuf_ref.sz; } - } stream{in_buf}; + struct ReadBufStream stream{in_buf}; return decode_png(stream, out_img); } +bool decode_colored_png(const ReadBuf &in_buf, ImageColorscale &out_img); + + // TODO: std::istream of FILE* could be similarly adapted in case its needed... diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index f640524ad..8382a7f7a 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -783,6 +783,8 @@ static std::vector s_Preset_filament_options { "temperature_vitrification", "reduce_fan_stop_start_freq", "slow_down_for_layer_cooling", "fan_min_speed", "fan_max_speed", "enable_overhang_bridge_fan", "overhang_fan_speed", "overhang_fan_threshold", "close_fan_the_first_x_layers", "full_fan_speed_layer", "fan_cooling_layer_time", "slow_down_layer_time", "slow_down_min_speed", "filament_start_gcode", "filament_end_gcode", + //exhaust fan control + "activate_air_filtration","during_print_exhaust_fan_speed","complete_print_exhaust_fan_speed", // Retract overrides "filament_retraction_length", "filament_z_hop", "filament_z_hop_types", "filament_retract_lift_above", "filament_retract_lift_below", "filament_retract_lift_enforce", "filament_retraction_speed", "filament_deretraction_speed", "filament_retract_restart_extra", "filament_retraction_minimum_travel", "filament_retract_when_changing_layer", "filament_wipe", "filament_retract_before_wipe", @@ -790,7 +792,7 @@ static std::vector s_Preset_filament_options { "filament_vendor", "compatible_prints", "compatible_prints_condition", "compatible_printers", "compatible_printers_condition", "inherits", //BBS "filament_wipe_distance", "additional_cooling_fan_speed", - "bed_temperature_difference", "nozzle_temperature_range_low", "nozzle_temperature_range_high", + "nozzle_temperature_range_low", "nozzle_temperature_range_high", //SoftFever "enable_pressure_advance", "pressure_advance","chamber_temperature", "filament_shrink", "support_material_interface_fan_speed", "filament_notes" /*,"filament_seam_gap"*/, "filament_loading_speed", "filament_loading_speed_start", "filament_load_time", @@ -811,7 +813,7 @@ static std::vector s_Preset_printer_options { "printer_technology", "printable_area", "bed_exclude_area","bed_custom_texture", "bed_custom_model", "gcode_flavor", "fan_kickstart", "fan_speedup_time", "fan_speedup_overhangs", - "single_extruder_multi_material", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "layer_change_gcode", "change_filament_gcode", + "single_extruder_multi_material", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "layer_change_gcode", "time_lapse_gcode", "change_filament_gcode", "printer_model", "printer_variant", "printable_height", "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", "default_print_profile", "inherits", "silent_mode", diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index a54b6d14c..8a5ead8dc 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -2828,6 +2828,7 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool std::pair PresetBundle::load_vendor_configs_from_json( const std::string &path, const std::string &vendor_name, LoadConfigBundleAttributes flags, ForwardCompatibilitySubstitutionRule compatibility_rule) { + CNumericLocalesSetter locales_setter; // Enable substitutions for user config bundle, throw an exception when loading a system profile. ConfigSubstitutionContext substitution_context { compatibility_rule }; PresetsConfigSubstitutions substitutions; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 96cf920f6..3a88bb41f 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -100,6 +100,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "printable_area", //BBS: add bed_exclude_area "bed_exclude_area", + "thumbnail_size", "before_layer_change_gcode", "enable_pressure_advance", "pressure_advance", @@ -146,6 +147,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "textured_plate_temp_initial_layer", "gcode_add_line_number", "layer_change_gcode", + "time_lapse_gcode", "fan_min_speed", "fan_max_speed", "printable_height", @@ -196,7 +198,10 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "gcode_label_objects", "exclude_object", "support_material_interface_fan_speed", - "single_extruder_multi_material_priming" + "single_extruder_multi_material_priming", + "activate_air_filtration", + "during_print_exhaust_fan_speed", + "complete_print_exhaust_fan_speed" }; static std::unordered_set steps_ignore; diff --git a/src/libslic3r/PrintBase.cpp b/src/libslic3r/PrintBase.cpp index 8b8b48188..5ba9306b5 100644 --- a/src/libslic3r/PrintBase.cpp +++ b/src/libslic3r/PrintBase.cpp @@ -110,11 +110,11 @@ void PrintBase::set_status(int percent, const std::string &message, unsigned in BOOST_LOG_TRIVIAL(debug) <m_status_callback) { - auto status = print_object ? SlicingStatus(*print_object, step, message, message_id) : SlicingStatus(*this, step, message, message_id); + auto status = print_object ? SlicingStatus(*print_object, step, message, message_id, warning_level) : SlicingStatus(*this, step, message, message_id, warning_level); m_status_callback(status); } else if (! message.empty()) @@ -122,12 +122,12 @@ void PrintBase::status_update_warnings(int step, PrintStateBase::WarningLevel /* } //BBS: add PrintObject id into slicing status -void PrintBase::status_update_warnings(int step, PrintStateBase::WarningLevel /* warning_level */, +void PrintBase::status_update_warnings(int step, PrintStateBase::WarningLevel warning_level, const std::string& message, PrintObjectBase &object, PrintStateBase::SlicingNotificationType message_id) { //BBS: add object it into slicing status if (this->m_status_callback) { - m_status_callback(SlicingStatus(object, step, message, message_id)); + m_status_callback(SlicingStatus(object, step, message, message_id, warning_level)); } else if (!message.empty()) BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", PrintObject warning: %1%\n")% message.c_str(); diff --git a/src/libslic3r/PrintBase.hpp b/src/libslic3r/PrintBase.hpp index e70d52e2c..70198e893 100644 --- a/src/libslic3r/PrintBase.hpp +++ b/src/libslic3r/PrintBase.hpp @@ -431,18 +431,18 @@ public: struct SlicingStatus { SlicingStatus(int percent, const std::string &text, unsigned int flags = 0, int warning_step = -1, - PrintStateBase::SlicingNotificationType msg_type = PrintStateBase::SlicingDefaultNotification) : - percent(percent), text(text), flags(flags), warning_step(warning_step), message_type(msg_type) + PrintStateBase::SlicingNotificationType msg_type = PrintStateBase::SlicingDefaultNotification, PrintStateBase::WarningLevel warning_level = PrintStateBase::WarningLevel::NON_CRITICAL) : + percent(percent), text(text), flags(flags), warning_step(warning_step), message_type(msg_type), warning_level(warning_level) { } SlicingStatus(const PrintBase &print, int warning_step, const std::string& text, - PrintStateBase::SlicingNotificationType msg_type = PrintStateBase::SlicingDefaultNotification) : - flags(UPDATE_PRINT_STEP_WARNINGS), warning_object_id(print.id()), text(text), warning_step(warning_step), message_type(msg_type) + PrintStateBase::SlicingNotificationType msg_type = PrintStateBase::SlicingDefaultNotification, PrintStateBase::WarningLevel warning_level = PrintStateBase::WarningLevel::NON_CRITICAL) : + flags(UPDATE_PRINT_STEP_WARNINGS), warning_object_id(print.id()), text(text), warning_step(warning_step), message_type(msg_type), warning_level(warning_level) { } SlicingStatus(const PrintObjectBase &print_object, int warning_step, const std::string& text, - PrintStateBase::SlicingNotificationType msg_type = PrintStateBase::SlicingDefaultNotification) : - flags(UPDATE_PRINT_OBJECT_STEP_WARNINGS), warning_object_id(print_object.id()), text(text), warning_step(warning_step), message_type(msg_type) + PrintStateBase::SlicingNotificationType msg_type = PrintStateBase::SlicingDefaultNotification, PrintStateBase::WarningLevel warning_level = PrintStateBase::WarningLevel::NON_CRITICAL) : + flags(UPDATE_PRINT_OBJECT_STEP_WARNINGS), warning_object_id(print_object.id()), text(text), warning_step(warning_step), message_type(msg_type), warning_level(warning_level) { } int percent { -1 }; @@ -466,6 +466,7 @@ public: int warning_step { -1 }; PrintStateBase::SlicingNotificationType message_type {PrintStateBase::SlicingDefaultNotification}; + PrintStateBase::WarningLevel warning_level {PrintStateBase::WarningLevel::NON_CRITICAL}; }; typedef std::function status_callback_type; // Default status console print out in the form of percent => message. @@ -532,7 +533,7 @@ protected: void status_update_warnings(int step, PrintStateBase::WarningLevel warning_level, const std::string &message, const PrintObjectBase* print_object = nullptr, PrintStateBase::SlicingNotificationType message_id = PrintStateBase::SlicingDefaultNotification); //BBS: add api to update printobject's warnings - void status_update_warnings(int step, PrintStateBase::WarningLevel /* warning_level */, + void status_update_warnings(int step, PrintStateBase::WarningLevel warning_level, const std::string& message, PrintObjectBase &object, PrintStateBase::SlicingNotificationType message_id = PrintStateBase::SlicingDefaultNotification); // If the background processing stop was requested, throw CanceledException. diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 2b2c8ba9b..46fc754a4 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -296,6 +296,15 @@ static t_config_enum_values s_keys_map_NozzleType { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(NozzleType) +static t_config_enum_values s_keys_map_PrinterStructure { + {"undefine", int(PrinterStructure::psUndefine)}, + {"corexy", int(PrinterStructure::psCoreXY)}, + {"i3", int(PrinterStructure::psI3)}, + {"hbot", int(PrinterStructure::psHbot)}, + {"delta", int(PrinterStructure::psDelta)} +}; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PrinterStructure) + static t_config_enum_values s_keys_map_PerimeterGeneratorType{ { "classic", int(PerimeterGeneratorType::Classic) }, { "arachne", int(PerimeterGeneratorType::Arachne) } @@ -492,7 +501,7 @@ void PrintConfigDef::init_common_params() def->mode = comAdvanced; def->cli = ConfigOptionDef::nocli; def->set_default_value(new ConfigOptionEnum(atKeyPassword)); - + // temporary workaround for compatibility with older Slicer { def = this->add("preset_name", coString); @@ -617,7 +626,7 @@ void PrintConfigDef::init_fff_params() def->enum_values.emplace_back("Textured PEI Plate"); def->enum_labels.emplace_back(L("Cool Plate")); def->enum_labels.emplace_back(L("Engineering Plate")); - def->enum_labels.emplace_back(L("High Temp Plate")); + def->enum_labels.emplace_back(L("Smooth PEI Plate / High Temp Plate")); def->enum_labels.emplace_back(L("Textured PEI Plate")); def->set_default_value(new ConfigOptionEnum(btPC)); @@ -1036,6 +1045,30 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionString()); def->cli = ConfigOptionDef::nocli; + def = this->add("activate_air_filtration",coBools); + def->label = L("Activate air filtration"); + def->tooltip = L("Activate for better air filtration"); + def->mode = comSimple; + def->set_default_value(new ConfigOptionBools{false}); + + def = this->add("during_print_exhaust_fan_speed", coInts); + def->label = L("Fan speed"); + def->tooltip=L("Speed of exhuast fan during printing.This speed will overwrite the speed in filament custom gcode"); + def->sidetext = L("%"); + def->min=0; + def->max=100; + def->mode = comSimple; + def->set_default_value(new ConfigOptionInts{60}); + + def = this->add("complete_print_exhaust_fan_speed", coInts); + def->label = L("Fan speed"); + def->sidetext = L("%"); + def->tooltip=L("Speed of exhuast fan after printing completes"); + def->min=0; + def->max=100; + def->mode = comSimple; + def->set_default_value(new ConfigOptionInts{80}); + def = this->add("close_fan_the_first_x_layers", coInts); def->label = L("No cooling for the first"); def->tooltip = L("Close all cooling fan for the first certain layers. Cooling fan of the first layer used to be closed " @@ -1558,12 +1591,17 @@ def = this->add("filament_loading_speed", coFloats); def->enum_values.push_back("PC"); def->enum_values.push_back("PA"); def->enum_values.push_back("PA-CF"); + def->enum_values.push_back("PA6-CF"); def->enum_values.push_back("PLA-CF"); def->enum_values.push_back("PET-CF"); def->enum_values.push_back("PETG-CF"); def->enum_values.push_back("PVA"); def->enum_values.push_back("HIPS"); def->enum_values.push_back("PLA-AERO"); + def->enum_values.push_back("PPS"); + def->enum_values.push_back("PPS-CF"); + def->enum_values.push_back("PPA-CF"); + def->enum_values.push_back("PPA-GF"); def->mode = comSimple; def->set_default_value(new ConfigOptionStrings { "PLA" }); @@ -1802,8 +1840,8 @@ def = this->add("filament_loading_speed", coFloats); def = this->add("accel_to_decel_factor", coPercent); def->label = L("accel_to_decel"); - def->tooltip = L("Klipper's max_accel_to_decel will be adjusted to this % of acceleration"); - def->sidetext = L("%"); + def->tooltip = L("Klipper's max_accel_to_decel will be adjusted to this %% of acceleration"); + def->sidetext = L("%%"); def->min = 1; def->max = 100; def->mode = comAdvanced; @@ -2034,6 +2072,15 @@ def = this->add("filament_loading_speed", coFloats); def->tooltip = L("Enable this to enable the camera on printer to check the quality of first layer"); def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool(false)); + + // BBS + def = this->add("thumbnail_size", coPoints); + def->label = L("Thumbnail size"); + def->tooltip = L("Decides the size of thumbnail stored in gcode files"); + def->mode = comDevelop; + def->gui_type = ConfigOptionDef::GUIType::one_string; + def->set_default_value(new ConfigOptionPoints{ Vec2d(50,50) }); + //BBS // def = this->add("spaghetti_detector", coBool); // def->label = L("Enable spaghetti detector"); @@ -2057,6 +2104,7 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(ntUndefine)); + def = this->add("nozzle_hrc", coInt); def->label = L("Nozzle HRC"); def->tooltip = L("The nozzle's hardness. Zero means no checking for nozzle's hardness during slicing."); @@ -2066,12 +2114,36 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comDevelop; def->set_default_value(new ConfigOptionInt{0}); + def = this->add("printer_structure", coEnum); + def->label = L("Printer structure"); + def->tooltip = L("The physical arrangement and components of a printing device"); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values.push_back("undefine"); + def->enum_values.push_back("corexy"); + def->enum_values.push_back("i3"); + def->enum_values.push_back("hbot"); + def->enum_values.push_back("delta"); + def->enum_labels.push_back(L("Undefine")); + def->enum_labels.push_back(L("CoreXY")); + def->enum_labels.push_back(L("I3")); + def->enum_labels.push_back(L("Hbot")); + def->enum_labels.push_back(L("Delta")); + def->mode = comDevelop; + def->set_default_value(new ConfigOptionEnum(psUndefine)); + + def = this->add("best_object_pos", coPoint); + def->label = L("Best object position"); + def->tooltip = L("Best auto arranging position in range [0,1] w.r.t. bed shape."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionPoint(Vec2d(0.5, 0.5))); + def = this->add("auxiliary_fan", coBool); def->label = L("Auxiliary part cooling fan"); def->tooltip = L("Enable this option if machine has auxiliary part cooling fan"); def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool(false)); + def = this->add("fan_speedup_time", coFloat); // Label is set in Tab.cpp in the Line object. //def->label = L("Fan speed-up time"); @@ -2102,6 +2174,19 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0)); + def =this->add("support_chamber_temp_control",coBool); + def->label=L("Support control chamber temperature"); + def->tooltip=L("This option is enabled if machine support controlling chamber temperature"); + def->mode=comDevelop; + def->set_default_value(new ConfigOptionBool(false)); + def->readonly=false; + + def =this->add("support_air_filtration",coBool); + def->label=L("Support air filtration"); + def->tooltip=L("Enable this if printer support air filtration"); + def->mode=comDevelop; + def->set_default_value(new ConfigOptionBool(false)); + def = this->add("gcode_flavor", coEnum); def->label = L("G-code flavor"); def->tooltip = L("What kind of gcode the printer is compatible with"); @@ -2298,6 +2383,14 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comAdvanced; def->set_default_value(new ConfigOptionString("")); + def = this->add("time_lapse_gcode",coString); + def->label = L("Time lapse G-code"); + def->multiline = true; + def->full_width = true; + def->height =5; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionString("")); + def = this->add("silent_mode", coBool); def->label = L("Supports silent mode"); def->tooltip = L("Whether the machine supports silent mode in which machine use lower acceleration to print"); @@ -2887,6 +2980,21 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comSimple; def->set_default_value(new ConfigOptionFloats { 0.4 }); + def = this->add("retract_lift_above", coFloats); + def->label = L("Z hop lower boundary"); + def->tooltip = L("Z hop will only come into effect when Z is above this value and is below the parameter: \"Z hop upper boundary\""); + def->sidetext = L("mm"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloats{0.}); + + def = this->add("retract_lift_below", coFloats); + def->label = L("Z hop upper boundary"); + def->tooltip = L("If this value is positive, Z hop will only come into effect when Z is above the parameter: \"Z hop lower boundary\" and is below this value"); + def->sidetext = L("mm"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloats{0.}); + + def = this->add("z_hop_types", coEnums); def->label = L("Z hop type"); def->tooltip = L("Z hop type"); @@ -3729,7 +3837,10 @@ def = this->add("filament_loading_speed", coFloats); def = this->add("chamber_temperature", coInts); def->label = L("Chamber temperature"); - def->tooltip = L("Target chamber temperature"); + def->tooltip = L("Higher chamber temperature can help suppress or reduce warping and potentially lead to higher interlayer bonding strength for high temperature materials like ABS, ASA, PC, PA and so on." + "At the same time, the air filtration of ABS and ASA will get worse.While for PLA, PETG, TPU, PVA and other low temperature materials," + "the actual chamber temperature should not be high to avoid cloggings, so 0 which stands for turning off is highly recommended" + ); def->sidetext = L("°C"); def->full_label = L("Chamber temperature"); def->min = 0; @@ -3761,15 +3872,6 @@ def = this->add("filament_loading_speed", coFloats); def->max = max_temp; def->set_default_value(new ConfigOptionInts { 240 }); - def = this->add("bed_temperature_difference", coInts); - def->label = L("Bed temperature difference"); - def->tooltip = L("Do not recommend bed temperature of other layer to be lower than initial layer for more than this threshold. " - "Too low bed temperature of other layer may cause the model broken free from build plate"); - def->sidetext = L("°C"); - def->min = 0; - def->max = 30; - def->mode = comDevelop; - def->set_default_value(new ConfigOptionInts { 10 }); def = this->add("detect_thin_wall", coBool); def->label = L("Detect thin wall"); @@ -4973,7 +5075,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va "remove_freq_sweep", "remove_bed_leveling", "remove_extrusion_calibration", "support_transition_line_width", "support_transition_speed", "bed_temperature", "bed_temperature_initial_layer", "can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector", "adaptive_layer_height", - "z_hop_type", "z_lift_type" + "z_hop_type", "z_lift_type", "bed_temperature_difference" }; if (ignore.find(opt_key) != ignore.end()) { @@ -5682,6 +5784,12 @@ CLIActionsConfigDef::CLIActionsConfigDef() def->cli_params = "option"; def->set_default_value(new ConfigOptionBool(false)); + def = this->add("min_save", coBool); + def->label = L("Minimum save"); + def->tooltip = L("export 3mf with minimum size."); + def->cli_params = "option"; + def->set_default_value(new ConfigOptionBool(false)); + def = this->add("mtcpp", coInt); def->label = L("mtcpp"); def->tooltip = L("max triangle count per plate for slicing."); @@ -5788,12 +5896,12 @@ CLITransformConfigDef::CLITransformConfigDef() def->cli_params = "count"; def->set_default_value(new ConfigOptionInt(1)); - /*def = this->add("ensure_on_bed", coBool); + def = this->add("ensure_on_bed", coBool); def->label = L("Ensure on bed"); - def->tooltip = L("Lift the object above the bed when it is partially below. Enabled by default, use --no-ensure-on-bed to disable."); - def->set_default_value(new ConfigOptionBool(true)); + def->tooltip = L("Lift the object above the bed when it is partially below. Disabled by default"); + def->set_default_value(new ConfigOptionBool(false)); - def = this->add("copy", coInt); + /*def = this->add("copy", coInt); def->label = L("Copy"); def->tooltip =L("Duplicate copies of model"); def->min = 1; @@ -5813,18 +5921,18 @@ CLITransformConfigDef::CLITransformConfigDef() def->tooltip = L("Convert the units of model"); def->set_default_value(new ConfigOptionBool(false)); - def = this->add("orient", coBool); - def->label = L("Orient"); - def->tooltip = L("Orient the model"); + def = this->add("orient", coInt); + def->label = L("Orient Options"); + def->tooltip = L("Orient options: 0-disable, 1-enable, others-auto"); //def->cli = "orient|o"; - def->set_default_value(new ConfigOptionBool(false)); + def->set_default_value(new ConfigOptionInt(0)); /*def = this->add("repair", coBool); def->label = L("Repair"); def->tooltip = L("Repair the model's meshes if it is non-manifold mesh"); def->set_default_value(new ConfigOptionBool(false));*/ - /*def = this->add("rotate", coFloat); + def = this->add("rotate", coFloat); def->label = L("Rotate"); def->tooltip = L("Rotation angle around the Z axis in degrees."); def->set_default_value(new ConfigOptionFloat(0)); @@ -5837,7 +5945,7 @@ CLITransformConfigDef::CLITransformConfigDef() def = this->add("rotate_y", coFloat); def->label = L("Rotate around Y"); def->tooltip = L("Rotation angle around the Y axis in degrees."); - def->set_default_value(new ConfigOptionFloat(0));*/ + def->set_default_value(new ConfigOptionFloat(0)); def = this->add("scale", coFloat); def->label = L("Scale"); @@ -5946,6 +6054,12 @@ CLIMiscConfigDef::CLIMiscConfigDef() def->tooltip = L("Render with a software renderer. The bundled MESA software renderer is loaded instead of the default OpenGL driver."); def->min = 0;*/ #endif /* _MSC_VER */ + + def = this->add("load_custom_gcodes", coString); + def->label = L("Load custom gcode"); + def->tooltip = L("Load custom gcode from json"); + def->cli_params = "custom_gcode_toolchange.json"; + def->set_default_value(new ConfigOptionString()); } const CLIActionsConfigDef cli_actions_config_def; @@ -6016,6 +6130,17 @@ Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg) if (!tmp.empty()) bed_poly = tmp[0]; return bed_poly; } +bool has_skirt(const DynamicPrintConfig& cfg) +{ + auto opt_skirt_height = cfg.option("skirt_height"); + auto opt_skirt_loops = cfg.option("skirt_loops"); + auto opt_draft_shield = cfg.option("draft_shield"); + return (opt_skirt_height && opt_skirt_height->getInt() > 0 && opt_skirt_loops && opt_skirt_loops->getInt() > 0) + || (opt_draft_shield && opt_draft_shield->getInt() != dsDisabled); +} +float get_real_skirt_dist(const DynamicPrintConfig& cfg) { + return has_skirt(cfg) ? cfg.opt_float("skirt_distance") : 0; +} } // namespace Slic3r #include diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 3d518f625..ef1e597a8 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -210,6 +210,15 @@ enum NozzleType { ntCount }; +// BBS +enum PrinterStructure { + psUndefine=0, + psCoreXY, + psI3, + psHbot, + psDelta +}; + // BBS enum ZHopType { zhtAuto = 0, @@ -877,12 +886,14 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionInts, required_nozzle_HRC)) // BBS ((ConfigOptionBool, scan_first_layer)) + ((ConfigOptionPoints, thumbnail_size)) // ((ConfigOptionBool, spaghetti_detector)) ((ConfigOptionBool, gcode_add_line_number)) ((ConfigOptionBool, bbl_bed_temperature_gcode)) ((ConfigOptionEnum, gcode_flavor)) ((ConfigOptionString, layer_change_gcode)) + ((ConfigOptionString, time_lapse_gcode)) //#ifdef HAS_PRESSURE_EQUALIZER // ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_positive)) // ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_negative)) @@ -914,6 +925,11 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionEnum, nozzle_type)) ((ConfigOptionInt, nozzle_hrc)) ((ConfigOptionBool, auxiliary_fan)) + ((ConfigOptionBool, support_air_filtration)) + ((ConfigOptionEnum,printer_structure)) + ((ConfigOptionBool, support_chamber_temp_control)) + + // SoftFever ((ConfigOptionBool, use_firmware_retraction)) ((ConfigOptionBool, use_relative_e_distances)) @@ -997,6 +1013,9 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloatOrPercent, bridge_acceleration)) ((ConfigOptionFloat, travel_acceleration)) ((ConfigOptionFloatOrPercent, sparse_infill_acceleration)) + ((ConfigOptionBools, activate_air_filtration)) + ((ConfigOptionInts, during_print_exhaust_fan_speed)) + ((ConfigOptionInts, complete_print_exhaust_fan_speed)) ((ConfigOptionFloatOrPercent, internal_solid_infill_acceleration)) ((ConfigOptionFloatOrPercent, initial_layer_line_width)) ((ConfigOptionFloat, initial_layer_print_height)) @@ -1018,6 +1037,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionInts, fan_min_speed)) ((ConfigOptionFloats, min_layer_height)) ((ConfigOptionFloat, printable_height)) + ((ConfigOptionPoint, best_object_pos)) ((ConfigOptionFloats, slow_down_min_speed)) ((ConfigOptionFloats, nozzle_diameter)) ((ConfigOptionBool, reduce_infill_retraction)) @@ -1039,7 +1059,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionInts , chamber_temperature)) ((ConfigOptionBools, wipe)) // BBS - ((ConfigOptionInts, bed_temperature_difference)) ((ConfigOptionInts, nozzle_temperature_range_low)) ((ConfigOptionInts, nozzle_temperature_range_high)) ((ConfigOptionFloats, wipe_distance)) @@ -1387,6 +1406,8 @@ Points get_bed_shape(const DynamicPrintConfig &cfg); Points get_bed_shape(const PrintConfig &cfg); Points get_bed_shape(const SLAPrinterConfig &cfg); Slic3r::Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg); +bool has_skirt(const DynamicPrintConfig& cfg); +float get_real_skirt_dist(const DynamicPrintConfig& cfg); // ModelConfig is a wrapper around DynamicPrintConfig with an addition of a timestamp. // Each change of ModelConfig is tracked by assigning a new timestamp from a global counter. diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 0d473bdc5..eed4c5c0a 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -493,7 +493,7 @@ void PrintObject::generate_support_material() {LargeOverhang,L("large overhangs")} }; std::string warning_message = format(L("It seems object %s has %s. Please re-orient the object or enable support generation."), this->model_object()->name, reasons[sntype]); - this->active_step_add_warning(PrintStateBase::WarningLevel::CRITICAL, warning_message, PrintStateBase::SlicingNeedSupportOn); + this->active_step_add_warning(PrintStateBase::WarningLevel::NON_CRITICAL, warning_message, PrintStateBase::SlicingNeedSupportOn); } #if 0 @@ -861,7 +861,7 @@ bool PrintObject::invalidate_state_by_config_options( } else if ( opt_key == "bottom_shell_layers" || opt_key == "top_shell_layers") { - + steps.emplace_back(posPrepareInfill); const auto *old_shell_layers = old_config.option(opt_key); @@ -873,7 +873,7 @@ bool PrintObject::invalidate_state_by_config_options( if (value_changed && this->object_extruders().size() > 1) { steps.emplace_back(posSlice); - } + } else if (m_print->config().spiral_mode && opt_key == "bottom_shell_layers") { // Changing the number of bottom layers when a spiral vase is enabled requires re-slicing the object again. // Otherwise, holes in the bottom layers could be filled, as is reported in GH #5528. diff --git a/src/libslic3r/ProjectTask.hpp b/src/libslic3r/ProjectTask.hpp index cc4a80d99..a86a24cf4 100644 --- a/src/libslic3r/ProjectTask.hpp +++ b/src/libslic3r/ProjectTask.hpp @@ -23,8 +23,9 @@ class BBLModelTask; enum MachineBedType { //BED_TYPE_AUTO = 0, BED_TYPE_PC = 0, - BED_TYPE_PEI, BED_TYPE_PE, + BED_TYPE_PEI, + BED_TYPE_PTE, BED_TYPE_COUNT, }; @@ -191,6 +192,8 @@ public: static BBLSubTask::SubTaskStatus parse_user_service_task_status(int status); }; +typedef std::function OnGetSubTaskFn; + class BBLTask { public: enum TaskStatus { diff --git a/src/libslic3r/ShortEdgeCollapse.cpp b/src/libslic3r/ShortEdgeCollapse.cpp index b36278c37..0c940cb47 100644 --- a/src/libslic3r/ShortEdgeCollapse.cpp +++ b/src/libslic3r/ShortEdgeCollapse.cpp @@ -97,7 +97,8 @@ void its_short_edge_collpase(indexed_triangle_set &mesh, size_t target_triangle_ //shuffle the faces and traverse in random order, this MASSIVELY improves the quality of the result std::shuffle(face_indices.begin(), face_indices.end(), generator); - + + int allowed_face_removals = int(face_indices.size()) - int(target_triangle_count); for (const size_t &face_idx : face_indices) { if (face_removal_flags[face_idx]) { // if face already removed from previous collapses, skip (each collapse removes two triangles [at least] ) @@ -130,10 +131,13 @@ void its_short_edge_collpase(indexed_triangle_set &mesh, size_t target_triangle_ // remove faces remove_face(face_idx, neighbor_to_remove_face_idx); remove_face(neighbor_to_remove_face_idx, face_idx); + allowed_face_removals-=2; // break. this triangle is done break; } + + if (allowed_face_removals <= 0) { break; } } // filter face_indices, remove those that have been collapsed diff --git a/src/libslic3r/TreeSupport.hpp b/src/libslic3r/TreeSupport.hpp index 1a706e433..2f3546ed2 100644 --- a/src/libslic3r/TreeSupport.hpp +++ b/src/libslic3r/TreeSupport.hpp @@ -419,6 +419,7 @@ private: std::vector> m_spanning_trees; std::vector< std::unordered_map> m_mst_line_x_layer_contour_caches; coordf_t MAX_BRANCH_RADIUS = 10.0; + coordf_t MAX_BRANCH_RADIUS_FIRST_LAYER = 12.0; coordf_t MIN_BRANCH_RADIUS = 0.5; float tree_support_branch_diameter_angle = 5.0; bool is_strong = false; diff --git a/src/libslic3r/TriangleSelector.cpp b/src/libslic3r/TriangleSelector.cpp index 0ac985fdf..929d3094b 100644 --- a/src/libslic3r/TriangleSelector.cpp +++ b/src/libslic3r/TriangleSelector.cpp @@ -254,8 +254,7 @@ void TriangleSelector::select_patch(int facet_start, std::unique_ptr &&c } } - const float highlight_angle_limit = cos(Geometry::deg2rad(highlight_by_angle_deg)); - Vec3f vec_down = (trafo_no_translate.inverse() * -Vec3d::UnitZ()).normalized().cast(); + const float highlight_angle_limit = -cos(Geometry::deg2rad(highlight_by_angle_deg)); // BBS std::vector start_facets; @@ -291,7 +290,9 @@ void TriangleSelector::select_patch(int facet_start, std::unique_ptr &&c while (facet_idx < int(facets_to_check.size())) { int facet = facets_to_check[facet_idx]; const Vec3f& facet_normal = m_face_normals[m_triangles[facet].source_triangle]; - if (!visited[facet] && (highlight_by_angle_deg == 0.f || vec_down.dot(facet_normal) >= highlight_angle_limit)) { + Matrix3f normal_matrix = static_cast(trafo_no_translate.matrix().block(0, 0, 3, 3).inverse().transpose().cast()); + float world_normal_z = (normal_matrix* facet_normal).normalized().z(); + if (!visited[facet] && (highlight_by_angle_deg == 0.f || world_normal_z < highlight_angle_limit)) { if (select_triangle(facet, new_state, triangle_splitting)) { // add neighboring facets to list to be processed later for (int neighbor_idx : m_neighbors[facet]) @@ -331,8 +332,7 @@ void TriangleSelector::seed_fill_select_triangles(const Vec3f &hit, int facet_st facet_queue.push(facet_start); const double facet_angle_limit = cos(Geometry::deg2rad(seed_fill_angle)) - EPSILON; - const float highlight_angle_limit = cos(Geometry::deg2rad(highlight_by_angle_deg)); - Vec3f vec_down = (trafo_no_translate.inverse() * -Vec3d::UnitZ()).normalized().cast(); + const float highlight_angle_limit = -cos(Geometry::deg2rad(highlight_by_angle_deg)); // Depth-first traversal of neighbors of the face hit by the ray thrown from the mouse cursor. while (!facet_queue.empty()) { @@ -340,7 +340,9 @@ void TriangleSelector::seed_fill_select_triangles(const Vec3f &hit, int facet_st facet_queue.pop(); const Vec3f &facet_normal = m_face_normals[m_triangles[current_facet].source_triangle]; - if (!visited[current_facet] && (highlight_by_angle_deg == 0.f || vec_down.dot(facet_normal) >= highlight_angle_limit)) { + Matrix3f normal_matrix = static_cast(trafo_no_translate.matrix().block(0, 0, 3, 3).inverse().transpose().cast()); + float world_normal_z = (normal_matrix * facet_normal).normalized().z(); + if (!visited[current_facet] && (highlight_by_angle_deg == 0.f || world_normal_z < highlight_angle_limit)) { if (m_triangles[current_facet].is_split()) { for (int split_triangle_idx = 0; split_triangle_idx <= m_triangles[current_facet].number_of_split_sides(); ++split_triangle_idx) { assert(split_triangle_idx < int(m_triangles[current_facet].children.size())); diff --git a/src/libslic3r/Utils.hpp b/src/libslic3r/Utils.hpp index 73004621e..376dee84e 100644 --- a/src/libslic3r/Utils.hpp +++ b/src/libslic3r/Utils.hpp @@ -60,6 +60,7 @@ #define CLI_FILAMENTS_DIFFERENT_TEMP -62 #define CLI_OBJECT_COLLISION_IN_SEQ_PRINT -63 #define CLI_OBJECT_COLLISION_IN_LAYER_PRINT -64 +#define CLI_SPIRAL_MODE_CANNOT_DUPLICATE -65 #define CLI_SLICING_ERROR -100 #define CLI_GCODE_PATH_CONFLICTS -101 diff --git a/src/libslic3r/calib.cpp b/src/libslic3r/calib.cpp index 3a22bbb05..93884f70f 100644 --- a/src/libslic3r/calib.cpp +++ b/src/libslic3r/calib.cpp @@ -666,6 +666,17 @@ void CalibPressureAdvancePattern::generate_custom_gcodes(const DynamicPrintConfi model.plates_custom_gcodes[model.curr_plate_index] = info; } +void CalibPressureAdvancePattern::set_start_offset(const Vec3d &offset) +{ + m_starting_point = offset; + m_is_start_point_fixed = true; +} + +Vec3d CalibPressureAdvancePattern::get_start_offset() +{ + return m_starting_point; +} + void CalibPressureAdvancePattern::refresh_setup(const DynamicPrintConfig &config, bool is_bbl_machine, const Model &model, @@ -683,6 +694,9 @@ void CalibPressureAdvancePattern::refresh_setup(const DynamicPrintConfig &config void CalibPressureAdvancePattern::_refresh_starting_point(const Model &model) { + if (m_is_start_point_fixed) + return; + ModelObject *obj = model.objects.front(); BoundingBoxf3 bbox = obj->instance_bounding_box(*obj->instances.front(), false); diff --git a/src/libslic3r/calib.hpp b/src/libslic3r/calib.hpp index 10c3e777e..b05c502b2 100644 --- a/src/libslic3r/calib.hpp +++ b/src/libslic3r/calib.hpp @@ -251,6 +251,9 @@ public: void generate_custom_gcodes(const DynamicPrintConfig &config, bool is_bbl_machine, Model &model, const Vec3d &origin); + void set_start_offset(const Vec3d &offset); + Vec3d get_start_offset(); + protected: double speed_first_layer() const { return m_config.option("initial_layer_speed")->value; }; double speed_perimeter() const { return m_config.option("outer_wall_speed")->value; }; @@ -293,6 +296,7 @@ private: GCodeWriter m_writer; bool m_is_delta; Vec3d m_starting_point; + bool m_is_start_point_fixed = false; const double m_handle_xy_size{5}; const double m_handle_spacing{2}; diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index 045a3fdb5..197b23295 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -747,16 +747,6 @@ bool AMSMaterialsSetting::Show(bool show) m_input_nozzle_min->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(20))); //m_clr_picker->set_color(m_clr_picker->GetParent()->GetBackgroundColour()); - /*if (obj && (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI) || obj->is_high_printer_type())) { - m_ratio_text->Show(); - m_k_param->Show(); - m_input_k_val->Show(); - } - else { - m_ratio_text->Hide(); - m_k_param->Hide(); - m_input_k_val->Hide(); - }*/ m_ratio_text->Show(); m_k_param->Show(); m_input_k_val->Show(); diff --git a/src/slic3r/GUI/AMSSetting.cpp b/src/slic3r/GUI/AMSSetting.cpp index 0818f5445..cad793ea4 100644 --- a/src/slic3r/GUI/AMSSetting.cpp +++ b/src/slic3r/GUI/AMSSetting.cpp @@ -192,8 +192,8 @@ void AMSSetting::create() wxPanel* m_panel_img = new wxPanel(m_panel_body, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_panel_img->SetBackgroundColour(AMS_SETTING_GREY200); wxBoxSizer *m_sizer_img = new wxBoxSizer(wxVERTICAL); - auto img = new wxStaticBitmap(m_panel_img, wxID_ANY, create_scaled_bitmap("ams_icon", nullptr, 126), wxDefaultPosition, wxDefaultSize); - m_sizer_img->Add(img, 0, wxALIGN_CENTER | wxTOP, 26); + ams_img = new wxStaticBitmap(m_panel_img, wxID_ANY, create_scaled_bitmap("ams_icon", nullptr, 126), wxDefaultPosition, wxDefaultSize); + m_sizer_img->Add(ams_img, 0, wxALIGN_CENTER | wxTOP, 26); m_sizer_img->Add(0, 0, 0, wxTOP, 18); m_panel_img->SetSizer(m_sizer_img); m_panel_img->Layout(); @@ -262,6 +262,19 @@ void AMSSetting::update_insert_material_read_mode(bool selected) Fit(); } +void AMSSetting::update_image(std::string ams_type) +{ + if (ams_type == m_current_ams_type) return; + if (ams_type == "generic") { + ams_img->SetBitmap(create_scaled_bitmap("monitor_upgrade_f1", nullptr, 126)); + } + else { + ams_img->SetBitmap(create_scaled_bitmap("ams_icon", nullptr, 126)); + } + m_current_ams_type = ams_type; + Layout(); +} + void AMSSetting::update_starting_read_mode(bool selected) { m_checkbox_starting_auto_read->SetValue(selected); diff --git a/src/slic3r/GUI/AMSSetting.hpp b/src/slic3r/GUI/AMSSetting.hpp index 0b227de29..6afaea68e 100644 --- a/src/slic3r/GUI/AMSSetting.hpp +++ b/src/slic3r/GUI/AMSSetting.hpp @@ -28,6 +28,7 @@ public: void create(); void update_insert_material_read_mode(bool selected); + void update_image(std::string ams_type); void update_starting_read_mode(bool selected); void update_remain_mode(bool selected); void update_switch_filament(bool selected); @@ -46,6 +47,7 @@ protected: void on_dpi_changed(const wxRect &suggested_rect) override; protected: + std::string m_current_ams_type; wxPanel * m_panel_body; CheckBox * m_checkbox_Insert_material_auto_read; wxStaticText *m_title_Insert_material_auto_read; @@ -68,7 +70,7 @@ protected: wxStaticText *m_tip_ams_img; Button * m_button_auto_demarcate; - + wxStaticBitmap* ams_img; wxBoxSizer *m_sizer_Insert_material_tip_inline; wxBoxSizer *m_sizer_starting_tip_inline; wxBoxSizer *m_sizer_remain_inline; diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index a91258280..cb3b947d7 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -273,7 +273,7 @@ void BackgroundSlicingProcess::process_sla() //BBS: add plate id for thumbnail generation ThumbnailsList thumbnails = this->render_thumbnails( - ThumbnailsParams{ THUMBNAIL_SIZE, true, true, true, true, 0 }); + ThumbnailsParams{ current_print()->full_print_config().option("thumbnail_size")->values, true, true, true, true, 0 }); Zipper zipper(export_path); m_sla_archive.export_print(zipper, *m_sla_print); // true, false, true, true); // renders also supports and pad diff --git a/src/slic3r/GUI/Calibration.cpp b/src/slic3r/GUI/Calibration.cpp index 62f4acff3..ab0b2b2a3 100644 --- a/src/slic3r/GUI/Calibration.cpp +++ b/src/slic3r/GUI/Calibration.cpp @@ -50,16 +50,16 @@ CalibrationDialog::CalibrationDialog(Plater *plater) select_xcam_cali = create_check_option(_L("Micro lidar calibration"), cali_left_panel, _L("Micro lidar calibration"), "xcam_cali"); select_bed_leveling = create_check_option(_L("Bed leveling"), cali_left_panel, _L("Bed leveling"), "bed_leveling"); - select_vibration = create_check_option(_L("Resonance frequency identification"), cali_left_panel, _L("Resonance frequency identification"), "vibration"); + select_vibration = create_check_option(_L("Vibration compensation"), cali_left_panel, _L("Vibration compensation"), "vibration"); + select_motor_noise = create_check_option(_L("Motor noise cancellation"), cali_left_panel, _L("Motor noise cancellation"), "motor_noise"); - m_checkbox_list["xcam_cali"]->SetValue(true); - m_checkbox_list["bed_leveling"]->SetValue(true); - m_checkbox_list["vibration"]->SetValue(true); + cali_left_sizer->Add(0, FromDIP(18), 0, wxEXPAND, 0); cali_left_sizer->Add(select_xcam_cali, 0, wxLEFT, FromDIP(15)); cali_left_sizer->Add(select_bed_leveling, 0, wxLEFT, FromDIP(15)); cali_left_sizer->Add(select_vibration, 0, wxLEFT, FromDIP(15)); + cali_left_sizer->Add(select_motor_noise, 0, wxLEFT, FromDIP(15)); cali_left_sizer->Add(0, FromDIP(30), 0, wxEXPAND, 0); auto cali_left_text_top = new wxStaticText(cali_left_panel, wxID_ANY, _L("Calibration program"), wxDefaultPosition, wxDefaultSize, 0); @@ -208,6 +208,7 @@ wxWindow* CalibrationDialog::create_check_option(wxString title, wxWindow* paren text->Bind(wxEVT_LEFT_DOWN, [this, check](wxMouseEvent&) { check->SetValue(check->GetValue() ? false : true); }); m_checkbox_list[param] = check; + m_checkbox_list[param]->SetValue(true); return checkbox; } @@ -219,6 +220,30 @@ void CalibrationDialog::update_cali(MachineObject *obj) select_xcam_cali->Show(); } else { select_xcam_cali->Hide(); + m_checkbox_list["xcam_cali"]->SetValue(false); + } + + if(obj->is_function_supported(PrinterFunction::FUNC_AUTO_LEVELING)){ + select_bed_leveling->Show(); + }else{ + select_bed_leveling->Hide(); + m_checkbox_list["bed_leveling"]->SetValue(false); + } + + if (obj->is_function_supported(PrinterFunction::FUNC_MOTOR_NOISE_CALI)) { + select_motor_noise->Show(); + } else { + select_motor_noise->Hide(); + m_checkbox_list["motor_noise"]->SetValue(false); + } + + if (!m_checkbox_list["vibration"]->GetValue() && !m_checkbox_list["bed_leveling"]->GetValue() && !m_checkbox_list["xcam_cali"]->GetValue() && + !m_checkbox_list["motor_noise"]->GetValue()) { + m_calibration_btn->Disable(); + m_calibration_btn->SetLabel(_L("No step selected")); + return ; + } else { + m_calibration_btn->Enable(); } if (obj->is_calibration_running() || obj->is_calibration_done()) { @@ -284,7 +309,8 @@ void CalibrationDialog::on_start_calibration(wxMouseEvent &event) m_obj->command_start_calibration( m_checkbox_list["vibration"]->GetValue(), m_checkbox_list["bed_leveling"]->GetValue(), - m_checkbox_list["xcam_cali"]->GetValue() + m_checkbox_list["xcam_cali"]->GetValue(), + m_checkbox_list["motor_noise"]->GetValue() ); } } diff --git a/src/slic3r/GUI/Calibration.hpp b/src/slic3r/GUI/Calibration.hpp index db01e5955..2bacea5f7 100644 --- a/src/slic3r/GUI/Calibration.hpp +++ b/src/slic3r/GUI/Calibration.hpp @@ -42,6 +42,7 @@ private: wxWindow* select_xcam_cali { nullptr }; wxWindow* select_bed_leveling { nullptr }; wxWindow* select_vibration { nullptr }; + wxWindow* select_motor_noise { nullptr }; wxWindow* create_check_option(wxString title, wxWindow *parent, wxString tooltip, std::string param); diff --git a/src/slic3r/GUI/CalibrationPanel.cpp b/src/slic3r/GUI/CalibrationPanel.cpp index 433473c2d..dfe27ec13 100644 --- a/src/slic3r/GUI/CalibrationPanel.cpp +++ b/src/slic3r/GUI/CalibrationPanel.cpp @@ -526,6 +526,14 @@ void CalibrationPanel::update_all() { if (!dev) return; obj = dev->get_selected_machine(); + // check valid machine + if (obj && dev->get_my_machine(obj->dev_id) == nullptr) { + dev->set_selected_machine(""); + if (m_agent) m_agent->set_user_selected_machine(""); + show_status((int) MONITOR_NO_PRINTER); + return; + } + // update current wizard only int curr_selected = m_tabpanel->GetSelection(); @@ -543,15 +551,6 @@ void CalibrationPanel::update_all() { } } - // check valid machine - if (obj && dev->get_my_machine(obj->dev_id) == nullptr) { - dev->set_selected_machine(""); - if (m_agent) - m_agent->set_user_selected_machine(""); - show_status((int)MONITOR_NO_PRINTER); - return; - } - if (wxGetApp().is_user_login()) { dev->check_pushing(); try { diff --git a/src/slic3r/GUI/CalibrationWizard.cpp b/src/slic3r/GUI/CalibrationWizard.cpp index 3f245db4e..f05cde89f 100644 --- a/src/slic3r/GUI/CalibrationWizard.cpp +++ b/src/slic3r/GUI/CalibrationWizard.cpp @@ -15,6 +15,9 @@ wxDEFINE_EVENT(EVT_DEVICE_CHANGED, wxCommandEvent); wxDEFINE_EVENT(EVT_CALIBRATION_JOB_FINISHED, wxCommandEvent); static const wxString NA_STR = _L("N/A"); +static const float MIN_PA_K_VALUE = 0.0; +static const float MAX_PA_K_VALUE = 0.5; +static const float MIN_PA_K_VALUE_STEP = 0.001; bool check_preset_name_valid(const wxString& name) { wxString error_message; @@ -46,6 +49,18 @@ std::map get_cached_selected_filament(MachineObject* obj) { return selected_filament_map; } +bool is_pa_params_valid(const Calib_Params& params) +{ + if (params.start < MIN_PA_K_VALUE || params.end > MAX_PA_K_VALUE || params.step < EPSILON || params.end < params.start + params.step) { + MessageDialog msg_dlg(nullptr, + wxString::Format(_L("Please input valid values:\nStart value: >= %.1f\nEnd value: <= %.1f\nEnd value: > Start value\nValue step: >= %.3f)"), MIN_PA_K_VALUE, MAX_PA_K_VALUE, MIN_PA_K_VALUE_STEP), + wxEmptyString, wxICON_WARNING | wxOK); + msg_dlg.ShowModal(); + return false; + } + return true; +} + CalibrationWizard::CalibrationWizard(wxWindow* parent, CalibMode mode, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : wxPanel(parent, id, pos, size, style) , m_mode(mode) @@ -136,6 +151,25 @@ void CalibrationWizard::on_device_connected(MachineObject* obj) recover_preset_info(obj); + BOOST_LOG_TRIVIAL(info) << "on_device_connected - machine object status:" + << " dev_id = " << obj->dev_id + << ", print_type = " << obj->printer_type + << ", printer_status = " << obj->print_status + << ", cali_finished = " << obj->cali_finished + << ", cali_version = " << obj->cali_version + << ", cache_flow_ratio = " << obj->cache_flow_ratio + << ", sub_task_name = " << obj->subtask_name + << ", gcode_file_name = " << obj->m_gcode_file; + + for (const CaliPresetInfo& preset_info : obj->selected_cali_preset) { + BOOST_LOG_TRIVIAL(info) << "on_device_connected - selected preset: " + << "tray_id = " << preset_info.tray_id + << ", nozzle_diameter = " << preset_info.nozzle_diameter + << ", filament_id = " << preset_info.filament_id + << ", settring_id = " << preset_info.setting_id + << ", name = " << preset_info.name; + } + for (int i = 0; i < m_page_steps.size(); i++) { if (m_page_steps[i]->page) m_page_steps[i]->page->on_device_connected(obj); @@ -154,14 +188,14 @@ void CalibrationWizard::set_cali_method(CalibrationMethod method) bool CalibrationWizard::save_preset(const std::string &old_preset_name, const std::string &new_preset_name, const std::map &key_values, std::string& message) { if (new_preset_name.empty()) { - message = L("The name cannot be empty."); + message = _u8L("The name cannot be empty."); return false; } PresetCollection *filament_presets = &wxGetApp().preset_bundle->filaments; Preset* preset = filament_presets->find_preset(old_preset_name); if (!preset) { - message = (boost::format(L("The selected preset: %1% is not found.")) % old_preset_name).str(); + message = (boost::format(_u8L("The selected preset: %1% is not found.")) % old_preset_name).str(); return false; } @@ -173,12 +207,12 @@ bool CalibrationWizard::save_preset(const std::string &old_preset_name, const st Preset *new_preset = filament_presets->find_preset(new_name); if (new_preset) { if (new_preset->is_system) { - message = L("The name cannot be the same as the system preset name."); + message = _u8L("The name cannot be the same as the system preset name."); return false; } if (new_preset != preset) { - message = L("The name is the same as another existing preset name"); + message = _u8L("The name is the same as another existing preset name"); return false; } if (new_preset != &filament_presets->get_edited_preset()) new_preset = &temp_preset; @@ -199,7 +233,7 @@ bool CalibrationWizard::save_preset(const std::string &old_preset_name, const st // Preset* preset = &m_presets.preset(it - m_presets.begin(), true); if (!new_preset) { BOOST_LOG_TRIVIAL(info) << "create new preset failed"; - message = L("create new preset failed."); + message = _u8L("create new preset failed."); return false; } @@ -339,6 +373,18 @@ PressureAdvanceWizard::PressureAdvanceWizard(wxWindow* parent, wxWindowID id, co create_pages(); } +void PressureAdvanceWizard::on_cali_job_finished(wxString evt_data) +{ + int cali_stage = 0; + CalibMode obj_cali_mode = CalibUtils::get_calib_mode_by_name(evt_data.ToStdString(), cali_stage); + + if (obj_cali_mode == m_mode) { + show_step(cali_step); + } + // change ui, hide + static_cast(preset_step->page)->on_cali_finished_job(); +} + void PressureAdvanceWizard::create_pages() { start_step = new CalibrationWizardPageStep(new CalibrationPAStartPage(m_scrolledWindow)); @@ -422,6 +468,7 @@ void PressureAdvanceWizard::on_device_connected(MachineObject* obj) CalibrationMethod method; int cali_stage = 0; CalibMode obj_cali_mode = get_obj_calibration_mode(obj, method, cali_stage); + obj->manual_pa_cali_method = ManualPaCaliMethod(cali_stage); // show cali step when obj is in pa calibration if (obj) { @@ -431,6 +478,8 @@ void PressureAdvanceWizard::on_device_connected(MachineObject* obj) if (obj_cali_mode == m_mode) { if (!obj->cali_finished && (obj->is_in_printing() || obj->is_printing_finished())) { CalibrationWizard::set_cali_method(method); + CalibrationCaliPage *cali_page = (static_cast(cali_step->page)); + cali_page->set_pa_cali_image(cali_stage); show_step(cali_step); } } @@ -504,11 +553,13 @@ void PressureAdvanceWizard::on_cali_start() return; } - if (curr_obj->get_printer_series() == PrinterSeries::SERIES_X1) { + //std::string error_message; + wxString wx_err_string; + if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO && curr_obj->get_printer_series() == PrinterSeries::SERIES_X1) { X1CCalibInfos calib_infos; - for (auto& item : selected_filaments) { - int nozzle_temp = -1; - int bed_temp = -1; + for (auto &item : selected_filaments) { + int nozzle_temp = -1; + int bed_temp = -1; float max_volumetric_speed = -1; if (!get_preset_info(item.second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) { @@ -517,54 +568,93 @@ void PressureAdvanceWizard::on_cali_start() } X1CCalibInfos::X1CCalibInfo calib_info; - calib_info.tray_id = item.first; - calib_info.nozzle_diameter = nozzle_dia; - calib_info.filament_id = item.second->filament_id; - calib_info.setting_id = item.second->setting_id; - calib_info.bed_temp = bed_temp; - calib_info.nozzle_temp = nozzle_temp; + calib_info.tray_id = item.first; + calib_info.nozzle_diameter = nozzle_dia; + calib_info.filament_id = item.second->filament_id; + calib_info.setting_id = item.second->setting_id; + calib_info.bed_temp = bed_temp; + calib_info.nozzle_temp = nozzle_temp; calib_info.max_volumetric_speed = max_volumetric_speed; calib_infos.calib_datas.push_back(calib_info); } + CalibUtils::calib_PA(calib_infos, 0, wx_err_string); // mode = 0 for auto - std::string error_message; - wxString wx_err_string; - if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) { - CalibUtils::calib_PA(calib_infos, 0, error_message); // mode = 0 for auto - wx_err_string = from_u8(error_message); - } else if (m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) { - CalibUtils::calib_PA(calib_infos, 1, error_message); // mode = 1 for manual - wx_err_string = from_u8(error_message); - } else { - assert(false); - } if (!wx_err_string.empty()) { MessageDialog msg_dlg(nullptr, wx_err_string, wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); + return; } - } - else if (curr_obj->get_printer_series() == PrinterSeries::SERIES_P1P) { + + show_step(m_curr_step->next); + } else if (m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) { if (selected_filaments.empty()) { BOOST_LOG_TRIVIAL(warning) << "CaliPreset: selected filaments is empty"; return; } + else { + int nozzle_temp = -1; + int bed_temp = -1; + float max_volumetric_speed = -1; + if (!get_preset_info(selected_filaments.begin()->second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) { + BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error"; + return; + } + + CalibInfo calib_info; + calib_info.dev_id = curr_obj->dev_id; + calib_info.select_ams = "[" + std::to_string(selected_filaments.begin()->first) + "]"; + Preset *preset = selected_filaments.begin()->second; + Preset * temp_filament_preset = new Preset(preset->type, preset->name + "_temp"); + temp_filament_preset->config = preset->config; - int nozzle_temp = -1; - int bed_temp = -1; - float max_volumetric_speed = -1; - if (!get_preset_info(selected_filaments.begin()->second->config, plate_type, nozzle_temp, bed_temp, max_volumetric_speed)) { - BOOST_LOG_TRIVIAL(error) << "CaliPreset: get preset info error"; - return; + calib_info.bed_type = plate_type; + calib_info.process_bar = preset_page->get_sending_progress_bar(); + calib_info.printer_prest = preset_page->get_printer_preset(curr_obj, nozzle_dia); + calib_info.print_prest = preset_page->get_print_preset(); + calib_info.filament_prest = temp_filament_preset; + + wxArrayString values = preset_page->get_custom_range_values(); + if (values.size() != 3) { + MessageDialog msg_dlg(nullptr, _L("The input value size must be 3."), wxEmptyString, wxICON_WARNING | wxOK); + msg_dlg.ShowModal(); + return; + } else { + values[0].ToDouble(&calib_info.params.start); + values[1].ToDouble(&calib_info.params.end); + values[2].ToDouble(&calib_info.params.step); + } + calib_info.params.mode = preset_page->get_pa_cali_method(); + calib_info.params.print_numbers = true; + + if (!is_pa_params_valid(calib_info.params)) + return; + + ManualPaCaliMethod pa_cali_method = ManualPaCaliMethod::PA_LINE; + CalibrationCaliPage *cali_page = (static_cast(cali_step->page)); + if (calib_info.params.mode == CalibMode::Calib_PA_Line) + pa_cali_method = ManualPaCaliMethod::PA_LINE; + else if (calib_info.params.mode == CalibMode::Calib_PA_Pattern) + pa_cali_method = ManualPaCaliMethod::PA_PATTERN; + + cali_page->set_pa_cali_image(int(pa_cali_method)); + curr_obj->manual_pa_cali_method = pa_cali_method; + + CalibUtils::calib_generic_PA(calib_info, wx_err_string); + + if (!wx_err_string.empty()) { + MessageDialog msg_dlg(nullptr, wx_err_string, wxEmptyString, wxICON_WARNING | wxOK); + msg_dlg.ShowModal(); + return; + } + + preset_page->on_cali_start_job(); } - - curr_obj->command_start_extrusion_cali(selected_filaments.begin()->first, - nozzle_temp, bed_temp, max_volumetric_speed, setting_id); } else { assert(false); + BOOST_LOG_TRIVIAL(error) << "CaliPreset: unsupported printer type or cali method"; + return; } - show_step(m_curr_step->next); - CalibrationCaliPage* cali_page = (static_cast(cali_step->page)); cali_page->clear_last_job_status(); } @@ -853,6 +943,7 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow if (!wx_err_string.empty()) { MessageDialog msg_dlg(nullptr, wx_err_string, wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); + return; } show_step(m_curr_step->next); @@ -903,9 +994,7 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow calib_info.filament_prest = temp_filament_preset; if (cali_stage > 0) { - std::string error_message; - CalibUtils::calib_flowrate(cali_stage, calib_info, error_message); - wx_err_string = from_u8(error_message); + CalibUtils::calib_flowrate(cali_stage, calib_info, wx_err_string); } else { wx_err_string = _L("Internal Error") + wxString(": Invalid calibration stage"); @@ -917,6 +1006,7 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow if (!wx_err_string.empty()) { MessageDialog msg_dlg(nullptr, wx_err_string, wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); + return; } preset_page->on_cali_start_job(); if (temp_filament_preset) @@ -1009,7 +1099,7 @@ void FlowRateWizard::on_cali_save() std::string message; if (!save_preset(old_preset_name, into_u8(new_preset_name), key_value_map, message)) { - MessageDialog error_msg_dlg(nullptr, message, wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog error_msg_dlg(nullptr, from_u8(message), wxEmptyString, wxICON_WARNING | wxOK); error_msg_dlg.ShowModal(); return; } @@ -1248,12 +1338,11 @@ void MaxVolumetricSpeedWizard::on_cali_start() calib_info.print_prest = preset_page->get_print_preset(); wxString wx_err_string; - std::string error_message; - CalibUtils::calib_max_vol_speed(calib_info, error_message); - wx_err_string = from_u8(error_message); + CalibUtils::calib_max_vol_speed(calib_info, wx_err_string); if (!wx_err_string.empty()) { MessageDialog msg_dlg(nullptr, wx_err_string, wxEmptyString, wxICON_WARNING | wxOK); msg_dlg.ShowModal(); + return; } preset_page->on_cali_start_job(); @@ -1288,7 +1377,7 @@ void MaxVolumetricSpeedWizard::on_cali_save() std::string message; if (!save_preset(old_preset_name, new_preset_name, key_value_map, message)) { - MessageDialog error_msg_dlg(nullptr, message, wxEmptyString, wxICON_WARNING | wxOK); + MessageDialog error_msg_dlg(nullptr, from_u8(message), wxEmptyString, wxICON_WARNING | wxOK); error_msg_dlg.ShowModal(); return; } diff --git a/src/slic3r/GUI/CalibrationWizard.hpp b/src/slic3r/GUI/CalibrationWizard.hpp index e5e55834f..158d42eea 100644 --- a/src/slic3r/GUI/CalibrationWizard.hpp +++ b/src/slic3r/GUI/CalibrationWizard.hpp @@ -105,6 +105,9 @@ class PressureAdvanceWizard : public CalibrationWizard { public: PressureAdvanceWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL); ~PressureAdvanceWizard() {}; + + void on_cali_job_finished(wxString evt_data) override; + protected: void create_pages(); diff --git a/src/slic3r/GUI/CalibrationWizardCaliPage.cpp b/src/slic3r/GUI/CalibrationWizardCaliPage.cpp index bd62a6621..2c59f80fd 100644 --- a/src/slic3r/GUI/CalibrationWizardCaliPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardCaliPage.cpp @@ -125,6 +125,17 @@ void CalibrationCaliPage::set_cali_img() } } +void CalibrationCaliPage::set_pa_cali_image(int stage) +{ + if (m_cali_mode == CalibMode::Calib_PA_Line && m_cali_method == CALI_METHOD_MANUAL) { + if (stage == 0) { + m_picture_panel->set_img(create_scaled_bitmap("fd_calibration_manual", nullptr, 400)); + } else if (stage == 1) { + m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual", nullptr, 400)); + } + } +} + void CalibrationCaliPage::clear_last_job_status() { m_is_between_start_and_running = true; @@ -132,6 +143,29 @@ void CalibrationCaliPage::clear_last_job_status() void CalibrationCaliPage::update(MachineObject* obj) { + if (this->IsShown()) { + if (obj) { + if (obj->print_status != "RUNNING") { + BOOST_LOG_TRIVIAL(info) << "on_show_cali_page - machine object status:" + << " dev_id = " << obj->dev_id + << ", print_type = " << obj->printer_type + << ", printer_status = " << obj->print_status + << ", is_connected = " << obj->is_connected() + << ", m_is_between_start_and_running = " << m_is_between_start_and_running + << ", cali_finished = " << obj->cali_finished + << ", cali_version = " << obj->cali_version + << ", cache_flow_ratio = " << obj->cache_flow_ratio + << ", sub_task_name = " << obj->subtask_name + << ", gcode_file_name = " << obj->m_gcode_file + << ", get_pa_calib_result" << obj->get_pa_calib_result + << ", get_flow_calib_result" << obj->get_flow_calib_result; + } + } + else { + BOOST_LOG_TRIVIAL(info) << "on_show_cali_page - machine object is nullptr"; + } + } + static int get_result_count = 0; // enable calibration when finished bool enable_cali = false; diff --git a/src/slic3r/GUI/CalibrationWizardCaliPage.hpp b/src/slic3r/GUI/CalibrationWizardCaliPage.hpp index cb608ddda..59a07aad3 100644 --- a/src/slic3r/GUI/CalibrationWizardCaliPage.hpp +++ b/src/slic3r/GUI/CalibrationWizardCaliPage.hpp @@ -27,6 +27,7 @@ public: void update_basic_print_data(bool def, float weight = 0.0, int prediction = 0); void reset_printing_values(); void clear_last_job_status(); + void set_pa_cali_image(int stage); void on_device_connected(MachineObject* obj) override; diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp index 3c1a63e9b..7f0528769 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.cpp @@ -5,6 +5,9 @@ #include "libslic3r/Print.hpp" namespace Slic3r { namespace GUI { +static int PA_LINE = 0; +static int PA_PATTERN = 1; + CaliPresetCaliStagePanel::CaliPresetCaliStagePanel( wxWindow* parent, wxWindowID id, @@ -124,6 +127,71 @@ void CaliPresetCaliStagePanel::set_flow_ratio_value(float flow_ratio) m_flow_ratio_value = flow_ratio; } +CaliComboBox::CaliComboBox(wxWindow* parent, + wxString title, + wxArrayString values, + int default_index, // default delected id + std::function on_value_change, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style) + : wxPanel(parent, id, pos, size, style) + , m_title(title) + , m_on_value_change_call_back(on_value_change) +{ + SetBackgroundColour(*wxWHITE); + m_top_sizer = new wxBoxSizer(wxVERTICAL); + m_top_sizer->AddSpacer(PRESET_GAP); + auto combo_title = new Label(this, title); + combo_title->SetFont(Label::Head_14); + combo_title->Wrap(-1); + m_top_sizer->Add(combo_title, 0, wxALL, 0); + m_top_sizer->AddSpacer(FromDIP(10)); + m_combo_box = new ComboBox(this, wxID_ANY, "", wxDefaultPosition, CALIBRATION_COMBOX_SIZE, 0, nullptr, wxCB_READONLY); + m_top_sizer->Add(m_combo_box, 0, wxALL, 0); + m_top_sizer->AddSpacer(PRESET_GAP); + + this->SetSizer(m_top_sizer); + m_top_sizer->Fit(this); + + // set values + for (int i = 0; i < values.size(); ++i) { + m_combo_box->AppendString(values[i]); + } + m_combo_box->SetSelection(default_index); + + // bind call back function + if (m_on_value_change_call_back) + m_combo_box->Bind(wxEVT_COMBOBOX, m_on_value_change_call_back); +} + +int CaliComboBox::get_selection() const +{ + if (m_combo_box) + return m_combo_box->GetSelection(); + + return 0; +} + +wxString CaliComboBox::get_value() const +{ + if (m_combo_box) + return m_combo_box->GetValue(); + + return wxString(); +} + +void CaliComboBox::set_values(const wxArrayString &values) +{ + if (m_combo_box) { + for (int i = 0; i < values.size(); ++i) { + m_combo_box->AppendString(values[i]); + } + m_combo_box->SetSelection(0); + } +} + CaliPresetWarningPanel::CaliPresetWarningPanel( wxWindow* parent, wxWindowID id, @@ -704,6 +772,13 @@ void CalibrationPresetPage::create_page(wxWindow* parent) m_filament_list_panel = new wxPanel(parent); m_filament_list_panel->SetBackgroundColour(*wxWHITE); create_filament_list_panel(m_filament_list_panel); + + if (m_cali_mode == CalibMode::Calib_PA_Line || m_cali_mode == CalibMode::Calib_PA_Pattern) { + wxArrayString pa_cali_modes; + pa_cali_modes.push_back(_L("Line")); + pa_cali_modes.push_back(_L("Pattern")); + m_pa_cali_method_combox = new CaliComboBox(parent, _L("Method"), pa_cali_modes); + } m_ext_spool_panel = new wxPanel(parent); create_ext_spool_panel(m_ext_spool_panel); @@ -719,9 +794,7 @@ void CalibrationPresetPage::create_page(wxWindow* parent) m_sending_panel->Hide(); - if (m_show_custom_range) { - m_custom_range_panel = new CaliPresetCustomRangePanel(parent); - } + m_custom_range_panel = new CaliPresetCustomRangePanel(parent); m_action_panel = new CaliPageActionPanel(parent, m_cali_mode, CaliPageType::CALI_PAGE_PRESET); @@ -732,11 +805,10 @@ void CalibrationPresetPage::create_page(wxWindow* parent) m_top_sizer->Add(m_selection_panel, 0); m_top_sizer->Add(m_filament_list_panel, 0); m_top_sizer->Add(m_ext_spool_panel, 0); + m_top_sizer->Add(m_pa_cali_method_combox, 0); + m_top_sizer->Add(m_custom_range_panel, 0); + m_top_sizer->AddSpacer(FromDIP(15)); m_top_sizer->Add(m_warning_panel, 0); - if (m_show_custom_range) { - m_top_sizer->Add(m_custom_range_panel, 0); - m_top_sizer->AddSpacer(FromDIP(15)); - } m_top_sizer->Add(m_tips_panel, 0); m_top_sizer->AddSpacer(PRESET_GAP); m_top_sizer->Add(m_sending_panel, 0, wxALIGN_CENTER); @@ -1430,16 +1502,50 @@ void CalibrationPresetPage::set_cali_filament_mode(CalibrationFilamentMode mode) void CalibrationPresetPage::set_cali_method(CalibrationMethod method) { CalibrationWizardPage::set_cali_method(method); - if (method == CalibrationMethod::CALI_METHOD_MANUAL && m_cali_mode == CalibMode::Calib_Flow_Rate) { - wxArrayString steps; - steps.Add(_L("Preset")); - steps.Add(_L("Calibration1")); - steps.Add(_L("Calibration2")); - steps.Add(_L("Record Factor")); - m_step_panel->set_steps_string(steps); - m_step_panel->set_steps(0); - if (m_cali_stage_panel) - m_cali_stage_panel->Show(); + if (method == CalibrationMethod::CALI_METHOD_MANUAL) { + if (m_cali_mode == CalibMode::Calib_Flow_Rate) { + wxArrayString steps; + steps.Add(_L("Preset")); + steps.Add(_L("Calibration1")); + steps.Add(_L("Calibration2")); + steps.Add(_L("Record Factor")); + m_step_panel->set_steps_string(steps); + m_step_panel->set_steps(0); + if (m_cali_stage_panel) + m_cali_stage_panel->Show(); + + if (m_pa_cali_method_combox) + m_pa_cali_method_combox->Show(false); + + if (m_custom_range_panel) + m_custom_range_panel->Show(false); + } + else if (m_cali_mode == CalibMode::Calib_PA_Line || m_cali_mode == CalibMode::Calib_PA_Pattern) { + if (m_cali_stage_panel) + m_cali_stage_panel->Show(false); + + if (m_pa_cali_method_combox) + m_pa_cali_method_combox->Show(); + + if (m_custom_range_panel) { + wxArrayString titles; + titles.push_back(_L("From k Value")); + titles.push_back(_L("To k Value")); + titles.push_back(_L("Step value")); + m_custom_range_panel->set_titles(titles); + + wxArrayString values; + Preset* printer_preset = get_printer_preset(curr_obj, get_nozzle_value()); + int extruder_type = printer_preset->config.opt_enum("extruder_type", 0); + values.push_back(_L("0")); + values.push_back(_L("0.5")); + values.push_back(_L("0.005")); + m_custom_range_panel->set_values(values); + + m_custom_range_panel->set_unit(_L("")); + m_custom_range_panel->Show(); + } + } } else { wxArrayString steps; @@ -1450,6 +1556,10 @@ void CalibrationPresetPage::set_cali_method(CalibrationMethod method) m_step_panel->set_steps(0); if (m_cali_stage_panel) m_cali_stage_panel->Show(false); + if (m_custom_range_panel) + m_custom_range_panel->Show(false); + if (m_pa_cali_method_combox) + m_pa_cali_method_combox->Show(false); } } @@ -1847,12 +1957,26 @@ std::string CalibrationPresetPage::get_print_preset_name() wxArrayString CalibrationPresetPage::get_custom_range_values() { - if (m_show_custom_range && m_custom_range_panel) { + if (m_custom_range_panel) { return m_custom_range_panel->get_values(); } return wxArrayString(); } +CalibMode CalibrationPresetPage::get_pa_cali_method() +{ + if (m_pa_cali_method_combox) { + int selected_mode = m_pa_cali_method_combox->get_selection(); + if (selected_mode == PA_LINE) { + return CalibMode::Calib_PA_Line; + } + else if (selected_mode == PA_PATTERN) { + return CalibMode::Calib_PA_Pattern; + } + } + return CalibMode::Calib_PA_Line; +} + MaxVolumetricSpeedPresetPage::MaxVolumetricSpeedPresetPage( wxWindow *parent, CalibMode cali_mode, bool custom_range, wxWindowID id, const wxPoint &pos, const wxSize &size, long style) : CalibrationPresetPage(parent, cali_mode, custom_range, id, pos, size, style) @@ -1861,7 +1985,7 @@ MaxVolumetricSpeedPresetPage::MaxVolumetricSpeedPresetPage( wxArrayString titles; titles.push_back(_L("From Volumetric Speed")); titles.push_back(_L("To Volumetric Speed")); - titles.push_back(_L("Step")); + titles.push_back(_L("Step value")); m_custom_range_panel->set_titles(titles); m_custom_range_panel->set_unit(_L("mm\u00B3/s")); diff --git a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp index 2816c4d7d..932752758 100644 --- a/src/slic3r/GUI/CalibrationWizardPresetPage.hpp +++ b/src/slic3r/GUI/CalibrationWizardPresetPage.hpp @@ -40,6 +40,30 @@ protected: float m_flow_ratio_value; }; +class CaliComboBox : public wxPanel +{ +public: + CaliComboBox(wxWindow *parent, + wxString title, + wxArrayString values, + int default_index = 0, // default delected id + std::function on_value_change = nullptr, + wxWindowID id = wxID_ANY, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxTAB_TRAVERSAL); + + int get_selection() const; + wxString get_value() const; + void set_values(const wxArrayString& values); + +private: + wxBoxSizer* m_top_sizer; + wxString m_title; + ComboBox* m_combo_box; + std::function m_on_value_change_call_back; +}; + class CaliPresetWarningPanel : public wxPanel { public: @@ -181,6 +205,7 @@ public: std::string get_print_preset_name(); wxArrayString get_custom_range_values(); + CalibMode get_pa_cali_method(); CaliPresetPageStatus get_page_status() { return m_page_status; } protected: @@ -227,6 +252,7 @@ protected: CaliPresetPageStatus get_status() { return m_page_status; } CaliPageStepGuide* m_step_panel{ nullptr }; + CaliComboBox * m_pa_cali_method_combox{nullptr}; CaliPresetCaliStagePanel* m_cali_stage_panel { nullptr }; wxPanel* m_selection_panel { nullptr }; wxPanel* m_filament_from_panel { nullptr }; diff --git a/src/slic3r/GUI/CalibrationWizardSavePage.cpp b/src/slic3r/GUI/CalibrationWizardSavePage.cpp index 48831693f..d2e027286 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.cpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.cpp @@ -462,10 +462,10 @@ void CaliPASaveManualPanel::create_panel(wxWindow* parent) auto complete_text_panel = new wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); complete_text_panel->SetBackgroundColour(*wxWHITE); wxBoxSizer* complete_text_sizer = new wxBoxSizer(wxVERTICAL); - auto complete_text = new Label(complete_text_panel, _L("Please find the best line on your plate")); - complete_text->SetFont(Label::Head_14); - complete_text->Wrap(CALIBRATION_TEXT_MAX_LENGTH); - complete_text_sizer->Add(complete_text, 0); + m_complete_text = new Label(complete_text_panel, _L("Please find the best line on your plate")); + m_complete_text->SetFont(Label::Head_14); + m_complete_text->Wrap(CALIBRATION_TEXT_MAX_LENGTH); + complete_text_sizer->Add(m_complete_text, 0); complete_text_panel->SetSizer(complete_text_sizer); m_top_sizer->Add(complete_text_panel, 0, wxEXPAND, 0); @@ -523,6 +523,21 @@ void CaliPASaveManualPanel::set_save_img() { } } +void CaliPASaveManualPanel::set_pa_cali_method(ManualPaCaliMethod method) +{ + if (method == ManualPaCaliMethod::PA_LINE) { + m_complete_text->SetLabel(_L("Please find the best line on your plate")); + set_save_img(); + } else if (method == ManualPaCaliMethod::PA_PATTERN) { + m_complete_text->SetLabel(_L("Please find the cornor with perfect degree of extrusion")); + if (wxGetApp().app_config->get_language_code() == "zh-cn") { + m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual_result_CN", nullptr, 350)); + } else { + m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual_result", nullptr, 350)); + } + } +} + void CaliPASaveManualPanel::set_default_name(const wxString& name) { m_save_name_input->GetTextCtrl()->SetValue(name); } @@ -610,10 +625,10 @@ void CaliPASaveP1PPanel::create_panel(wxWindow* parent) auto complete_text_panel = new wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); complete_text_panel->SetBackgroundColour(*wxWHITE); wxBoxSizer* complete_text_sizer = new wxBoxSizer(wxVERTICAL); - auto complete_text = new Label(complete_text_panel, _L("Please find the best line on your plate")); - complete_text->SetFont(Label::Head_14); - complete_text->Wrap(CALIBRATION_TEXT_MAX_LENGTH); - complete_text_sizer->Add(complete_text, 0, wxEXPAND); + m_complete_text = new Label(complete_text_panel, _L("Please find the best line on your plate")); + m_complete_text->SetFont(Label::Head_14); + m_complete_text->Wrap(CALIBRATION_TEXT_MAX_LENGTH); + complete_text_sizer->Add(m_complete_text, 0, wxEXPAND); complete_text_panel->SetSizer(complete_text_sizer); m_top_sizer->Add(complete_text_panel, 0, wxEXPAND, 0); @@ -662,6 +677,22 @@ void CaliPASaveP1PPanel::set_save_img() { } } +void CaliPASaveP1PPanel::set_pa_cali_method(ManualPaCaliMethod method) +{ + if (method == ManualPaCaliMethod::PA_LINE) { + m_complete_text->SetLabel(_L("Please find the best line on your plate")); + set_save_img(); + } + else if (method == ManualPaCaliMethod::PA_PATTERN) { + m_complete_text->SetLabel(_L("Please find the cornor with perfect degree of extrusion")); + if (wxGetApp().app_config->get_language_code() == "zh-cn") { + m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual_result_CN", nullptr, 350)); + } else { + m_picture_panel->set_img(create_scaled_bitmap("fd_pattern_manual_result", nullptr, 350)); + } + } +} + bool CaliPASaveP1PPanel::get_result(float* out_k, float* out_n){ // Check if the value is valid if (!CalibUtils::validate_input_k_value(m_k_val->GetTextCtrl()->GetValue(), out_k)) { @@ -808,6 +839,7 @@ void CalibrationPASavePage::sync_cali_result(MachineObject* obj) void CalibrationPASavePage::show_panels(CalibrationMethod method, const PrinterSeries printer_ser) { if (printer_ser == PrinterSeries::SERIES_X1) { if (method == CalibrationMethod::CALI_METHOD_MANUAL) { + m_manual_panel->set_pa_cali_method(curr_obj->manual_pa_cali_method); m_manual_panel->Show(); m_auto_panel->Show(false); } @@ -820,10 +852,12 @@ void CalibrationPASavePage::show_panels(CalibrationMethod method, const PrinterS else if (printer_ser == PrinterSeries::SERIES_P1P) { m_auto_panel->Show(false); m_manual_panel->Show(false); + m_p1p_panel->set_pa_cali_method(curr_obj->manual_pa_cali_method); m_p1p_panel->Show(); } else { m_auto_panel->Show(false); m_manual_panel->Show(false); + m_p1p_panel->set_pa_cali_method(curr_obj->manual_pa_cali_method); m_p1p_panel->Show(); assert(false); } @@ -1158,10 +1192,10 @@ void CalibrationFlowCoarseSavePage::create_page(wxWindow* parent) coarse_block_items.Add(std::to_string(-20 + (i * 5))); } m_optimal_block_coarse->Set(coarse_block_items); - auto coarse_calc_result_text = new Label(parent, ""); + m_coarse_calc_result_text = new Label(parent, ""); coarse_value_sizer->Add(coarse_value_text, 0, 0); coarse_value_sizer->Add(m_optimal_block_coarse, 0, 0); - coarse_value_sizer->Add(coarse_calc_result_text, 0); + coarse_value_sizer->Add(m_coarse_calc_result_text, 0); m_top_sizer->Add(coarse_value_sizer, 0, 0, 0); m_top_sizer->AddSpacer(FromDIP(20)); @@ -1169,16 +1203,16 @@ void CalibrationFlowCoarseSavePage::create_page(wxWindow* parent) checkBox_panel->SetBackgroundColour(*wxWHITE); auto cb_sizer = new wxBoxSizer(wxHORIZONTAL); checkBox_panel->SetSizer(cb_sizer); - auto checkBox_skip_calibration = new CheckBox(checkBox_panel); - cb_sizer->Add(checkBox_skip_calibration); + m_checkBox_skip_calibration = new CheckBox(checkBox_panel); + cb_sizer->Add(m_checkBox_skip_calibration); auto cb_text = new Label(checkBox_panel, _L("Skip Calibration2")); cb_sizer->Add(cb_text); - cb_text->Bind(wxEVT_LEFT_DOWN, [this, checkBox_skip_calibration](auto&) { - checkBox_skip_calibration->SetValue(!checkBox_skip_calibration->GetValue()); + cb_text->Bind(wxEVT_LEFT_DOWN, [this](auto&) { + m_checkBox_skip_calibration->SetValue(!m_checkBox_skip_calibration->GetValue()); wxCommandEvent event(wxEVT_TOGGLEBUTTON); - event.SetEventObject(checkBox_skip_calibration); - checkBox_skip_calibration->GetEventHandler()->ProcessEvent(event); + event.SetEventObject(m_checkBox_skip_calibration); + m_checkBox_skip_calibration->GetEventHandler()->ProcessEvent(event); }); m_top_sizer->Add(checkBox_panel, 0, 0, 0); @@ -1201,8 +1235,8 @@ void CalibrationFlowCoarseSavePage::create_page(wxWindow* parent) m_top_sizer->AddSpacer(FromDIP(20)); - checkBox_skip_calibration->Bind(wxEVT_TOGGLEBUTTON, [this, save_panel, checkBox_skip_calibration](wxCommandEvent& e) { - if (checkBox_skip_calibration->GetValue()) { + m_checkBox_skip_calibration->Bind(wxEVT_TOGGLEBUTTON, [this, save_panel](wxCommandEvent &e) { + if (m_checkBox_skip_calibration->GetValue()) { m_skip_fine_calibration = true; save_panel->Show(); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_FLOW_COARSE_SAVE); @@ -1219,9 +1253,9 @@ void CalibrationFlowCoarseSavePage::create_page(wxWindow* parent) e.Skip(); }); - m_optimal_block_coarse->Bind(wxEVT_COMBOBOX, [this, coarse_calc_result_text](auto& e) { + m_optimal_block_coarse->Bind(wxEVT_COMBOBOX, [this](auto& e) { m_coarse_flow_ratio = m_curr_flow_ratio * (100.0f + stof(m_optimal_block_coarse->GetValue().ToStdString())) / 100.0f; - coarse_calc_result_text->SetLabel(wxString::Format(_L("flow ratio : %s "), std::to_string(m_coarse_flow_ratio))); + m_coarse_calc_result_text->SetLabel(wxString::Format(_L("flow ratio : %s "), std::to_string(m_coarse_flow_ratio))); }); m_action_panel = new CaliPageActionPanel(parent, m_cali_mode, CaliPageType::CALI_PAGE_COARSE_SAVE); @@ -1237,8 +1271,15 @@ void CalibrationFlowCoarseSavePage::set_save_img() { } } -void CalibrationFlowCoarseSavePage::set_default_name(const wxString& name) { +void CalibrationFlowCoarseSavePage::set_default_options(const wxString& name) { + m_optimal_block_coarse->SetSelection(-1); + m_coarse_calc_result_text->SetLabelText(""); + m_checkBox_skip_calibration->SetValue(false); m_save_name_input->GetTextCtrl()->SetValue(name); + + wxCommandEvent event(wxEVT_TOGGLEBUTTON); + event.SetEventObject(m_checkBox_skip_calibration); + m_checkBox_skip_calibration->GetEventHandler()->ProcessEvent(event); } bool CalibrationFlowCoarseSavePage::is_skip_fine_calibration() { @@ -1272,7 +1313,7 @@ bool CalibrationFlowCoarseSavePage::Show(bool show) { assert(curr_obj->selected_cali_preset.size() <= 1); if (!curr_obj->selected_cali_preset.empty()) { wxString default_name = get_default_name(curr_obj->selected_cali_preset[0].name, CalibMode::Calib_Flow_Rate); - set_default_name(default_name); + set_default_options(default_name); set_curr_flow_ratio(curr_obj->cache_flow_ratio); } } @@ -1337,10 +1378,10 @@ void CalibrationFlowFineSavePage::create_page(wxWindow* parent) fine_block_items.Add(std::to_string(-9 + (i))); } m_optimal_block_fine->Set(fine_block_items); - auto fine_calc_result_text = new Label(parent, ""); + m_fine_calc_result_text = new Label(parent, ""); fine_value_sizer->Add(fine_value_text, 0, 0); fine_value_sizer->Add(m_optimal_block_fine, 0, 0); - fine_value_sizer->Add(fine_calc_result_text, 0); + fine_value_sizer->Add(m_fine_calc_result_text, 0); m_top_sizer->Add(fine_value_sizer, 0, 0, 0); m_top_sizer->AddSpacer(FromDIP(20)); @@ -1354,9 +1395,9 @@ void CalibrationFlowFineSavePage::create_page(wxWindow* parent) m_top_sizer->AddSpacer(FromDIP(20)); - m_optimal_block_fine->Bind(wxEVT_COMBOBOX, [this, fine_calc_result_text](auto& e) { + m_optimal_block_fine->Bind(wxEVT_COMBOBOX, [this](auto& e) { m_fine_flow_ratio = m_curr_flow_ratio * (100.0f + stof(m_optimal_block_fine->GetValue().ToStdString())) / 100.0f; - fine_calc_result_text->SetLabel(wxString::Format(_L("flow ratio : %s "), std::to_string(m_fine_flow_ratio))); + m_fine_calc_result_text->SetLabel(wxString::Format(_L("flow ratio : %s "), std::to_string(m_fine_flow_ratio))); }); m_action_panel = new CaliPageActionPanel(parent, m_cali_mode, CaliPageType::CALI_PAGE_FINE_SAVE); @@ -1371,7 +1412,9 @@ void CalibrationFlowFineSavePage::set_save_img() { } } -void CalibrationFlowFineSavePage::set_default_name(const wxString& name) { +void CalibrationFlowFineSavePage::set_default_options(const wxString &name) { + m_optimal_block_fine->SetSelection(-1); + m_fine_calc_result_text->SetLabelText(""); m_save_name_input->GetTextCtrl()->SetValue(name); } @@ -1402,7 +1445,7 @@ bool CalibrationFlowFineSavePage::Show(bool show) { assert(curr_obj->selected_cali_preset.size() <= 1); if (!curr_obj->selected_cali_preset.empty()) { wxString default_name = get_default_name(curr_obj->selected_cali_preset[0].name, CalibMode::Calib_Flow_Rate); - set_default_name(default_name); + set_default_options(default_name); set_curr_flow_ratio(curr_obj->cache_flow_ratio); } } diff --git a/src/slic3r/GUI/CalibrationWizardSavePage.hpp b/src/slic3r/GUI/CalibrationWizardSavePage.hpp index 7a3b01c95..6396d12e7 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.hpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.hpp @@ -119,6 +119,7 @@ public: long style = wxTAB_TRAVERSAL); void create_panel(wxWindow* parent); void set_save_img(); + void set_pa_cali_method(ManualPaCaliMethod method); void set_machine_obj(MachineObject* obj) { m_obj = obj; } @@ -130,6 +131,7 @@ public: protected: wxBoxSizer* m_top_sizer; + Label * m_complete_text; CaliPagePicture* m_picture_panel; ::TextInput* m_save_name_input; ::TextInput* m_k_val; @@ -149,11 +151,13 @@ public: long style = wxTAB_TRAVERSAL); void create_panel(wxWindow* parent); void set_save_img(); + void set_pa_cali_method(ManualPaCaliMethod method); bool get_result(float* out_k, float* out_n); protected: wxBoxSizer* m_top_sizer; + Label * m_complete_text; CaliPagePicture* m_picture_panel; ::TextInput* m_k_val; ::TextInput* m_n_val; @@ -223,7 +227,7 @@ public: void create_page(wxWindow* parent); void set_save_img(); - void set_default_name(const wxString& name); + void set_default_options(const wxString &name); bool is_skip_fine_calibration(); @@ -239,6 +243,9 @@ protected: ComboBox* m_optimal_block_coarse; TextInput* m_save_name_input; + Label* m_coarse_calc_result_text; + CheckBox* m_checkBox_skip_calibration; + bool m_skip_fine_calibration = false; float m_curr_flow_ratio; float m_coarse_flow_ratio; @@ -252,7 +259,7 @@ public: void create_page(wxWindow* parent); void set_save_img(); - void set_default_name(const wxString& name); + void set_default_options(const wxString &name); void set_curr_flow_ratio(float value); @@ -266,6 +273,8 @@ protected: ComboBox* m_optimal_block_fine; TextInput* m_save_name_input; + Label* m_fine_calc_result_text; + float m_curr_flow_ratio; float m_fine_flow_ratio; }; diff --git a/src/slic3r/GUI/CalibrationWizardStartPage.cpp b/src/slic3r/GUI/CalibrationWizardStartPage.cpp index a15d59edf..551cd6c5b 100644 --- a/src/slic3r/GUI/CalibrationWizardStartPage.cpp +++ b/src/slic3r/GUI/CalibrationWizardStartPage.cpp @@ -155,17 +155,11 @@ void CalibrationPAStartPage::on_device_connected(MachineObject* obj) m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false); } } - else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P) { + else if (obj->get_printer_series() == PrinterSeries::SERIES_P1P || obj->get_printer_arch() == PrinterArch::ARCH_I3) { m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false); m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); - - if (!obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { - m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true); - } - else { - m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false); - } + m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false); } //is support auto cali diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index e801e92be..43ca7e0c0 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -109,39 +109,6 @@ void ConfigManipulation::check_nozzle_temperature_initial_layer_range(DynamicPri } } -void ConfigManipulation::check_bed_temperature_difference(int bed_type, DynamicPrintConfig* config) -{ - if (is_msg_dlg_already_exist) - return; - - if (config->has("bed_temperature_difference") && config->has("temperature_vitrification")) { - int bed_temp_difference = config->opt_int("bed_temperature_difference", 0); - int vitrification = config->opt_int("temperature_vitrification", 0); - const ConfigOptionInts* bed_temp_1st_layer_opt = config->option(get_bed_temp_1st_layer_key((BedType)bed_type)); - const ConfigOptionInts* bed_temp_opt = config->option(get_bed_temp_key((BedType)bed_type)); - - if (bed_temp_1st_layer_opt != nullptr && bed_temp_opt != nullptr) { - int first_layer_bed_temp = bed_temp_1st_layer_opt->get_at(0); - int bed_temp = bed_temp_opt->get_at(0); - if (first_layer_bed_temp - bed_temp > bed_temp_difference) { - const wxString msg_text = wxString::Format(_L("Bed temperature of other layer is lower than bed temperature of initial layer for more than %d degree centigrade.\nThis may cause model broken free from build plate during printing"), bed_temp_difference); - MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK); - is_msg_dlg_already_exist = true; - dialog.ShowModal(); - is_msg_dlg_already_exist = false; - } - - if (first_layer_bed_temp > vitrification || bed_temp > vitrification) { - const wxString msg_text = wxString::Format( - _L("Bed temperature is higher than vitrification temperature of this filament.\nThis may cause nozzle blocked and printing failure\nPlease keep the printer open during the printing process to ensure air circulation or reduce the temperature of the hot bed")); - MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK); - is_msg_dlg_already_exist = true; - dialog.ShowModal(); - is_msg_dlg_already_exist = false; - } - } - } -} void ConfigManipulation::check_filament_max_volumetric_speed(DynamicPrintConfig *config) { @@ -163,6 +130,32 @@ void ConfigManipulation::check_filament_max_volumetric_speed(DynamicPrintConfig } +void ConfigManipulation::check_chamber_temperature(DynamicPrintConfig* config) +{ + const static std::maprecommend_temp_map = { + {"PLA",45}, + {"PLA-CF",45}, + {"PVA",45}, + {"TPU",50}, + {"PETG",55}, + {"PETG-CF",55} + }; + bool support_chamber_temp_control=GUI::wxGetApp().preset_bundle->printers.get_selected_preset().config.opt_bool("support_chamber_temp_control"); + if (support_chamber_temp_control&&config->has("chamber_temperatures")) { + std::string filament_type = config->option("filament_type")->get_at(0); + auto iter = recommend_temp_map.find(filament_type); + if (iter!=recommend_temp_map.end()) { + if (iter->second < config->option("chamber_temperatures")->get_at(0)) { + wxString msg_text = wxString::Format(_L("Current chamber temperature is higher than the material's safe temperature,it may result in material softening and clogging.The maximum safe temperature for the material is %d"), iter->second); + MessageDialog dialog(m_msg_dlg_parent, msg_text, "", wxICON_WARNING | wxOK); + is_msg_dlg_already_exist = true; + dialog.ShowModal(); + is_msg_dlg_already_exist = false; + } + } + } +} + void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, const bool is_global_config) { // #ys_FIXME_to_delete @@ -285,6 +278,12 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con config->opt_enum("timelapse_type") == TimelapseType::tlTraditional)) { wxString msg_text = _(L("Spiral mode only works when wall loops is 1, support is disabled, top shell layers is 0, sparse infill density is 0 and timelapse type is traditional.")); + + auto printer_structure_opt = wxGetApp().preset_bundle->printers.get_edited_preset().config.option>("printer_structure"); + if (printer_structure_opt && printer_structure_opt->value == PrinterStructure::psI3) { + msg_text += _(L(" But machines with I3 structure will not generate timelapse videos.")); + } + if (is_global_config) msg_text += "\n\n" + _(L("Change these settings automatically? \n" "Yes - Change these settings and enable spiral mode automatically\n" diff --git a/src/slic3r/GUI/ConfigManipulation.hpp b/src/slic3r/GUI/ConfigManipulation.hpp index db4389d94..da856c416 100644 --- a/src/slic3r/GUI/ConfigManipulation.hpp +++ b/src/slic3r/GUI/ConfigManipulation.hpp @@ -76,8 +76,8 @@ public: //BBS: FFF filament nozzle temperature range void check_nozzle_temperature_range(DynamicPrintConfig* config); void check_nozzle_temperature_initial_layer_range(DynamicPrintConfig* config); - void check_bed_temperature_difference(int bed_type, DynamicPrintConfig* config); void check_filament_max_volumetric_speed(DynamicPrintConfig *config); + void check_chamber_temperature(DynamicPrintConfig* config); void set_is_BBL_Printer(bool is_bbl_printer) { is_BBL_Printer = is_bbl_printer; }; // SLA print void update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config = false); diff --git a/src/slic3r/GUI/ConnectPrinter.cpp b/src/slic3r/GUI/ConnectPrinter.cpp index 93ea0c34b..cabda0afb 100644 --- a/src/slic3r/GUI/ConnectPrinter.cpp +++ b/src/slic3r/GUI/ConnectPrinter.cpp @@ -8,7 +8,6 @@ namespace Slic3r { namespace GUI { ConnectPrinterDialog::ConnectPrinterDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) : DPIDialog(parent, id, _L("ConnectPrinter(LAN)"), pos, size, style) { - init_bitmap(); SetBackgroundColour(*wxWHITE); this->SetSizeHints(wxDefaultSize, wxDefaultSize); @@ -86,7 +85,7 @@ ConnectPrinterDialog::ConnectPrinterDialog(wxWindow *parent, wxWindowID id, cons wxBoxSizer *sizer_diagram; sizer_diagram = new wxBoxSizer(wxHORIZONTAL); - m_bitmap_diagram = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(FromDIP(340), FromDIP(190)), 0); + m_bitmap_diagram = new wxStaticBitmap(this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize(FromDIP(340), -1), 0); m_bitmap_diagram->SetBitmap(m_diagram_img); sizer_diagram->Add(m_bitmap_diagram); @@ -117,19 +116,48 @@ void ConnectPrinterDialog::init_bitmap() { AppConfig *config = get_app_config(); std::string language = config->get("language"); - if (language == "zh_CN") { - m_diagram_bmp = create_scaled_bitmap("input_access_code_cn", nullptr, 190); + + if (m_obj) { + if (m_obj->printer_type == "C11" || m_obj->printer_type == "C12") { + m_diagram_bmp = create_scaled_bitmap("input_accesscode_help2", nullptr, 190); + } + else if (m_obj->printer_type == "BL-P001" || m_obj->printer_type == "BL-P002" || m_obj->printer_type == "C13") { + if (language == "zh_CN") { + m_diagram_bmp = create_scaled_bitmap("input_access_code_cn", nullptr, 190); + } + else { + m_diagram_bmp = create_scaled_bitmap("input_access_code_en", nullptr, 190); + } + } + else if (m_obj->printer_type == "N1") { + if (language == "zh_CN") { + m_diagram_bmp = create_scaled_bitmap("input_access_code_n1_cn", nullptr, 250); + } + else { + m_diagram_bmp = create_scaled_bitmap("input_access_code_n1_en", nullptr, 250); + } + } } - else{ - m_diagram_bmp = create_scaled_bitmap("input_access_code_en", nullptr, 190); + else { + if (language == "zh_CN") { + m_diagram_bmp = create_scaled_bitmap("input_access_code_cn", nullptr, 190); + } + else { + m_diagram_bmp = create_scaled_bitmap("input_access_code_en", nullptr, 190); + } } m_diagram_img = m_diagram_bmp.ConvertToImage(); - m_diagram_img.Rescale(FromDIP(340), FromDIP(190)); + auto bmp_size = m_diagram_bmp.GetSize(); + float scale = (float)FromDIP(340) / (float)bmp_size.x; + m_diagram_img.Rescale(FromDIP(340), bmp_size.y * scale); + m_bitmap_diagram->SetBitmap(m_diagram_img); + Fit(); } void ConnectPrinterDialog::set_machine_object(MachineObject* obj) { m_obj = obj; + init_bitmap(); } void ConnectPrinterDialog::on_input_enter(wxCommandEvent& evt) diff --git a/src/slic3r/GUI/ConnectPrinter.hpp b/src/slic3r/GUI/ConnectPrinter.hpp index d73a3ba63..db45bd118 100644 --- a/src/slic3r/GUI/ConnectPrinter.hpp +++ b/src/slic3r/GUI/ConnectPrinter.hpp @@ -34,7 +34,7 @@ protected: wxBitmap m_diagram_bmp; wxImage m_diagram_img; - MachineObject* m_obj; + MachineObject* m_obj{ nullptr }; wxString m_input_access_code; public: ConnectPrinterDialog(wxWindow * parent, diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index dd9c757ae..4829b7e55 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -21,7 +21,7 @@ namespace pt = boost::property_tree; -const int PRINTING_STAGE_COUNT = 20; +const int PRINTING_STAGE_COUNT = 32; std::string PRINTING_STAGE_STR[PRINTING_STAGE_COUNT] = { "printing", "bed_leveling", @@ -42,7 +42,19 @@ std::string PRINTING_STAGE_STR[PRINTING_STAGE_COUNT] = { "user_pause", "toolhead_shell_off_pause", "scanner_laser_para_cali", - "extruder_absolute_flow_cali" + "extruder_absolute_flow_cali", + "hotend_temperature_error_pause", // 20 + "heated_bed_temperature_error_pause", + "filament_unloading", + "skip_step_pause", + "filament_loading", + "motor_noise_calibration", + "ams_lost_pause", + "heat_break_fan_pause", + "chamber_temperature_control_error_pause", + "chamber_cooling", + "user_insert_gcode_pause", + "motor_noise_showoff" }; @@ -97,6 +109,26 @@ wxString get_stage_string(int stage) return _L("Paused due to nozzle temperature malfunction"); case 21: return _L("Paused due to heat bed temperature malfunction"); + case 22: + return _L("Filament unloading"); + case 23: + return _L("Skip step pause"); + case 24: + return _L("Filament loading"); + case 25: + return _L("Motor noise calibration"); + case 26: + return _L("Paused due to AMS lost"); + case 27: + return _L("Paused due to low speed of the heat break fan"); + case 28: + return _L("Paused due to chamber temperature control error"); + case 29: + return _L("Cooling chamber"); + case 30: + return _L("Paused by the Gcode inserted by user"); + case 31: + return _L("Motor noise showoff"); default: ; } @@ -139,6 +171,18 @@ void split_string(std::string s, std::vector& v) { v.push_back(t); } +PrinterArch get_printer_arch_by_str(std::string arch_str) +{ + if (arch_str == "i3") { + return PrinterArch::ARCH_I3; + } + else if (arch_str == "core_xy") { + return PrinterArch::ARCH_CORE_XY; + } + + return PrinterArch::ARCH_CORE_XY; +} + void AmsTray::update_color_from_str(std::string color) { if (color.empty()) return; @@ -241,10 +285,7 @@ bool HMSItem::parse_hms_info(unsigned attr, unsigned code) { bool result = true; unsigned int model_id_int = (attr >> 24) & 0xFF; - if (model_id_int < (unsigned) MODULE_MAX) - this->module_id = (ModuleID)model_id_int; - else - this->module_id = MODULE_UKNOWN; + this->module_id = (ModuleID)model_id_int; this->module_num = (attr >> 16) & 0xFF; this->part_id = (attr >> 8) & 0xFF; this->reserved = (attr >> 0) & 0xFF; @@ -420,7 +461,7 @@ bool MachineObject::is_high_printer_type() PrinterSeries MachineObject::get_printer_series() const { - if (printer_type == "BL-P001" || printer_type == "BL-P002") + if (printer_type == "BL-P001" || printer_type == "BL-P002" || printer_type == "C13") return PrinterSeries::SERIES_X1; else if (printer_type == "C11" || printer_type == "C12") return PrinterSeries::SERIES_P1P; @@ -428,6 +469,11 @@ PrinterSeries MachineObject::get_printer_series() const return PrinterSeries::SERIES_P1P; } +PrinterArch MachineObject::get_printer_arch() const +{ + return DeviceManager::get_printer_arch(printer_type); +} + MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string id, std::string ip) :dev_name(name), dev_id(id), @@ -448,6 +494,7 @@ MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string bed_temp = 0.0f; bed_temp_target = 0.0f; chamber_temp = 0.0f; + chamber_temp_target = 0.0f; frame_temp = 0.0f; /* ams fileds */ @@ -693,7 +740,7 @@ bool MachineObject::is_U0_firmware() bool MachineObject::is_support_ams_mapping() { - if (get_printer_series() == PrinterSeries::SERIES_X1) { + if (get_printer_series() == PrinterSeries::SERIES_X1 && printer_type != "C13") { AppConfig* config = Slic3r::GUI::wxGetApp().app_config; if (config) { if (config->get("check_ams_version") == "0") @@ -725,6 +772,27 @@ bool MachineObject::is_support_ams_mapping() } } +bool MachineObject::is_support_command_ams_switch() +{ + auto ota_ver_it = module_vers.find("ota"); + if (ota_ver_it != module_vers.end()) { + if (printer_type == "BL-P001" || printer_type == "BL-P002") { + + if (ota_ver_it->second.sw_ver.compare("01.05.06.01") < 0) { + return false; + } + + }else if (printer_type == "C11" || printer_type == "C12") { + + if (ota_ver_it->second.sw_ver.compare("01.02.99.10") < 0) { + return false; + } + } + } + + return true; +} + bool MachineObject::is_support_ams_mapping_version(std::string module, std::string version) { bool result = true; @@ -1311,7 +1379,15 @@ void MachineObject::parse_status(int flag) ams_auto_switch_filament_flag = ((flag >> 10) & 0x1) != 0; } + if (xcam_prompt_sound_hold_count > 0) + xcam_prompt_sound_hold_count--; + else { + xcam_allow_prompt_sound = ((flag >> 17) & 0x1) != 0; + } + sdcard_state = MachineObject::SdcardState((flag >> 8) & 0x11); + + network_wired = ((flag >> 18) & 0x1) != 0; } PrintingSpeedLevel MachineObject::_parse_printing_speed_lvl(int lvl) @@ -1381,48 +1457,69 @@ void MachineObject::parse_version_func() auto rv1126_version = module_vers.find("rv1126"); if (get_printer_series() == PrinterSeries::SERIES_X1) { if (ota_version != module_vers.end()) { - if (ota_version->second.sw_ver.compare("01.01.01.00") <= 0) { - ams_support_remain = false; - ams_support_auto_switch_filament_flag = false; - is_xcam_buildplate_supported = false; - xcam_support_recovery_step_loss = false; - is_support_send_to_sdcard = false; - is_support_1080dpi = false; - is_support_ai_monitoring = false; - is_support_ams_humidity = false; - } else { - ams_support_remain = true; - ams_support_auto_switch_filament_flag = true; - is_xcam_buildplate_supported = true; - xcam_support_recovery_step_loss = true; - is_support_send_to_sdcard = true; - is_support_1080dpi = true; - is_support_ai_monitoring = true; - is_support_ams_humidity = true; - } - if (ota_version != module_vers.end()) { - if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION) { - local_use_ssl_for_mqtt = ota_version->second.sw_ver.compare("01.03.01.04") >= 0; - } - - if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION) { - is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.05.06.05") >= 0; - } - else if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) { - is_support_mqtt_alive = ota_version->second.sw_ver.compare("00.03.10.05") >= 0; + if (printer_type != "C13") { + if (ota_version->second.sw_ver.compare("01.01.01.00") <= 0) { + ams_support_remain = false; + ams_support_auto_switch_filament_flag = false; + is_xcam_buildplate_supported = false; + xcam_support_recovery_step_loss = false; + is_support_send_to_sdcard = false; + is_support_1080dpi = false; + is_support_ai_monitoring = false; + is_support_ams_humidity = false; } else { - is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.05.06.05") >= 0; + ams_support_remain = true; + ams_support_auto_switch_filament_flag = true; + is_xcam_buildplate_supported = true; + xcam_support_recovery_step_loss = true; + is_support_send_to_sdcard = true; + is_support_1080dpi = true; + is_support_ai_monitoring = true; + is_support_ams_humidity = true; } - is_support_remote_tunnel = true; - is_support_tunnel_mqtt = (ota_version->second.sw_ver.compare("01.05.06.06") >= 0 - || (rv1126_version != module_vers.end() && rv1126_version->second.sw_ver.compare("00.00.21.20") >= 0)); + if (ota_version != module_vers.end()) { + if (firmware_type == PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION) { + local_use_ssl_for_mqtt = ota_version->second.sw_ver.compare("01.03.01.04") >= 0; + } + + if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_PRODUCTION) { + is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.05.06.05") >= 0; + } + else if (lifecycle == PrinterFirmwareType::FIRMWARE_TYPE_ENGINEER) { + is_support_mqtt_alive = ota_version->second.sw_ver.compare("00.03.10.05") >= 0; + } + else { + is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.05.06.05") >= 0; + } + + is_support_remote_tunnel = true; + is_support_tunnel_mqtt = (ota_version->second.sw_ver.compare("01.05.06.06") >= 0 + || (rv1126_version != module_vers.end() && rv1126_version->second.sw_ver.compare("00.00.21.20") >= 0)); + } + local_camera_proto = local_rtsp_url.empty() ? -1 : local_rtsp_url == "disable" ? 0 + : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? 2 : 3; + file_proto = 2; + } + else { + ams_support_remain = true; + ams_support_auto_switch_filament_flag = true; + is_xcam_buildplate_supported = true; + xcam_support_recovery_step_loss = true; + is_support_send_to_sdcard = true; + is_support_1080dpi = true; + is_support_ai_monitoring = true; + is_support_ams_humidity = true; + is_support_mqtt_alive = true; + local_use_ssl_for_mqtt = true; + is_support_remote_tunnel = true; + is_support_tunnel_mqtt = true; + local_camera_proto = local_rtsp_url.empty() ? -1 : local_rtsp_url == "disable" ? 0 + : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? 2 : 3; + file_proto = 2; } - local_camera_proto = local_rtsp_url.empty() ? -1 : local_rtsp_url == "disable" ? 0 - : boost::algorithm::starts_with(local_rtsp_url, "rtsps") ? 2 : 3; - file_proto = 2; } } else if (printer_type == "C11") { is_cloud_print_only = true; @@ -1469,6 +1566,13 @@ void MachineObject::parse_version_func() is_support_mqtt_alive = ota_version->second.sw_ver.compare("01.03.50.01") >= 0; } } + } else if (printer_type == "N1") { + is_support_remote_tunnel = true; + local_camera_proto = 1; + is_support_tunnel_mqtt = true; + is_support_ams_humidity = false; + is_support_1080dpi = true; + ams_support_remain = false; } } @@ -1672,24 +1776,46 @@ int MachineObject::command_set_nozzle(int temp) return this->publish_gcode(gcode_str); } +int MachineObject::command_set_chamber(int temp) +{ + json j; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["command"] = "set_ctt"; + j["print"]["ctt_val"] = temp; + + return this->publish_json(j.dump(), 1); +} + int MachineObject::command_ams_switch(int tray_index, int old_temp, int new_temp) { BOOST_LOG_TRIVIAL(trace) << "ams_switch to " << tray_index << " with temp: " << old_temp << ", " << new_temp; + if (old_temp < 0) old_temp = FILAMENT_DEF_TEMP; if (new_temp < 0) new_temp = FILAMENT_DEF_TEMP; - int tray_id_int = tray_index; + int result = 0; - std::string gcode = ""; - if (tray_index == 255) { - gcode = DeviceManager::load_gcode(printer_type, "ams_unload.gcode"); - } else { - // include VIRTUAL_TRAY_ID - gcode = DeviceManager::load_gcode(printer_type, "ams_load.gcode"); - boost::replace_all(gcode, "[next_extruder]", std::to_string(tray_index)); - boost::replace_all(gcode, "[new_filament_temp]", std::to_string(new_temp)); + + //command + if (is_support_command_ams_switch()) { + command_ams_change_filament(tray_index, old_temp, new_temp); + } + //gcode + else { + std::string gcode = ""; + if (tray_index == 255) { + gcode = DeviceManager::load_gcode(printer_type, "ams_unload.gcode"); + } + else { + // include VIRTUAL_TRAY_ID + gcode = DeviceManager::load_gcode(printer_type, "ams_load.gcode"); + boost::replace_all(gcode, "[next_extruder]", std::to_string(tray_index)); + boost::replace_all(gcode, "[new_filament_temp]", std::to_string(new_temp)); + } + + result = this->publish_gcode(gcode); } - return this->publish_gcode(gcode); + return result; } int MachineObject::command_ams_change_filament(int tray_id, int old_temp, int new_temp) @@ -1902,6 +2028,15 @@ int MachineObject::command_set_printing_option(bool auto_recovery) return this->publish_json(j.dump()); } +int MachineObject::command_set_prompt_sound(bool prompt_sound){ + json j; + j["print"]["command"] = "print_option"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + j["print"]["sound_enable"] = prompt_sound; + + return this->publish_json(j.dump()); +} + int MachineObject::command_ams_switch_filament(bool switch_filament) { json j; @@ -1916,8 +2051,17 @@ int MachineObject::command_ams_switch_filament(bool switch_filament) return this->publish_json(j.dump()); } -int MachineObject::command_axis_control(std::string axis, double unit, double value, int speed) + +int MachineObject::command_axis_control(std::string axis, double unit, double input_val, int speed) { + double value = input_val; + if (!is_core_xy()) { + if ( axis.compare("Y") == 0 + || axis.compare("Z") == 0) { + value = -1.0 * input_val; + } + } + char cmd[256]; if (axis.compare("X") == 0 || axis.compare("Y") == 0 @@ -1956,7 +2100,7 @@ bool MachineObject::is_support_command_calibration() return true; } -int MachineObject::command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali) +int MachineObject::command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali, bool motor_noise) { if (!is_support_command_calibration()) { // fixed gcode file @@ -1969,7 +2113,8 @@ int MachineObject::command_start_calibration(bool vibration, bool bed_leveling, json j; j["print"]["command"] = "calibration"; j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); - j["print"]["option"] = (vibration ? 1 << 2 : 0) + j["print"]["option"]= (motor_noise ? 1 << 3 : 0) + + (vibration ? 1 << 2 : 0) + (bed_leveling ? 1 << 1 : 0) + (xcam_cali ? 1 << 0 : 0); return this->publish_json(j.dump()); @@ -2264,6 +2409,13 @@ int MachineObject::command_xcam_control_auto_recovery_step_loss(bool on_off) return command_set_printing_option(on_off); } +int MachineObject::command_xcam_control_allow_prompt_sound(bool on_off) +{ + xcam_allow_prompt_sound = on_off; + xcam_prompt_sound_hold_count = HOLD_COUNT_MAX; + return command_set_prompt_sound(on_off); +} + void MachineObject::set_bind_status(std::string status) { bind_user_name = status; @@ -2347,6 +2499,13 @@ bool MachineObject::is_printing_finished() return false; } +bool MachineObject::is_core_xy() +{ + if (get_printer_arch() == PrinterArch::ARCH_CORE_XY) + return true; + return false; +} + void MachineObject::reset_update_time() { BOOST_LOG_TRIVIAL(trace) << "reset reset_update_time, dev_id =" << dev_id; @@ -2373,6 +2532,8 @@ void MachineObject::reset() m_is_support_show_bak = false; extruder_axis_status = LOAD; nozzle_diameter = 0.0f; + network_wired = false; + dev_connection_name = ""; // reset print_json json empty_j; @@ -2513,7 +2674,10 @@ bool MachineObject::is_function_supported(PrinterFunction func) func_name = "FUNC_CAMERA_VIDEO"; break; case FUNC_MEDIA_FILE: - func_name = "FUNC_MEDIA_FILE"; + func_name = "FUNC_MEDIA_FILE"; + break; + case FUNC_PROMPT_SOUND: + func_name = "FUNC_PROMPT_SOUND"; break; case FUNC_REMOTE_TUNNEL: parse_version_func(); @@ -2551,6 +2715,9 @@ bool MachineObject::is_function_supported(PrinterFunction func) case FUNC_CHAMBER_FAN: func_name = "FUNC_CHAMBER_FAN"; break; + case FUNC_AUX_FAN: + func_name = "FUNC_AUX_FAN"; + break; case FUNC_EXTRUSION_CALI: if (!ams_support_virtual_tray) return false; @@ -2567,6 +2734,9 @@ bool MachineObject::is_function_supported(PrinterFunction func) case FUNC_FILAMENT_BACKUP: func_name = "FUNC_FILAMENT_BACKUP"; break; + case FUNC_MOTOR_NOISE_CALI: + func_name = "FUNC_MOTOR_NOISE_CALI"; + break; default: return true; } @@ -2586,7 +2756,7 @@ bool MachineObject::is_support_print_with_timelapse() bool MachineObject::is_camera_busy_off() { - if (printer_type == "C11" || printer_type == "C12") + if (printer_type == "C11" || printer_type == "C12" || printer_type == "N1") return is_in_prepare() || is_in_upgrading(); return false; } @@ -2708,6 +2878,34 @@ int MachineObject::parse_json(std::string payload) } } if (jj.contains("command")) { + + if (jj["command"].get() == "ams_change_filament") { + if (jj.contains("errno")) { + if (jj["errno"].is_number()) { + if (jj["errno"].get() == -2) { + wxString text = _L("The current chamber temperature or the target chamber temperature exceeds 45\u2103.In order to avoid extruder clogging,low temperature filament(PLA/PETG/TPU) is not allowed to be loaded."); + GUI::wxGetApp().show_dialog(text); + } + } + } + } + + if (jj["command"].get() == "set_ctt") { + if (m_agent && is_studio_cmd(sequence_id)) { + if (jj["errno"].is_number()) { + if (jj["errno"].get() == -2) { + wxString text = _L("Low temperature filament(PLA/PETG/TPU) is loaded in the extruder.In order to avoid extruder clogging,it is not allowed to set the chamber temperature above 45\u2103."); + GUI::wxGetApp().show_dialog(text); + } + else if (jj["errno"].get() == -4) { + wxString text = _L("When you set the chamber temperature below 40\u2103, the chamber temperature control will not be activated. And the target chamber temperature will automatically be set to 0\u2103."); + GUI::wxGetApp().show_dialog(text); + } + } + } + } + + if (jj["command"].get() == "push_status") { m_push_count++; last_push_time = std::chrono::system_clock::now(); @@ -2910,6 +3108,11 @@ int MachineObject::parse_json(std::string payload) chamber_temp = jj["chamber_temper"].get(); } } + if (jj.contains("ctt")) { + if (jj["ctt"].is_number()) { + chamber_temp_target = jj["ctt"].get(); + } + } /* signals */ if (jj.contains("link_th_state")) link_th = jj["link_th_state"].get(); @@ -4087,7 +4290,7 @@ int MachineObject::parse_json(std::string payload) if (it->contains("confidence")) { flow_ratio_calib_result.confidence = (*it)["confidence"].get(); } else { - flow_ratio_calib_result.confidence = 0; + flow_ratio_calib_result.confidence = 0; } flow_ratio_results.push_back(flow_ratio_calib_result); @@ -4256,7 +4459,8 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil } if (project_id.compare("0") == 0 - || profile_id.compare("0") == 0) return; + || profile_id.compare("0") == 0 + || subtask_id.compare("0") == 0) return; BOOST_LOG_TRIVIAL(trace) << "slice_info: start"; slice_info = new BBLSliceInfo(); @@ -4268,9 +4472,35 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil if (plate_idx >= 0) { plate_index = plate_idx; } else { - if (subtask_id.compare("0") == 0) - return; - m_agent->get_task_plate_index(subtask_id, &plate_index); + + std::string subtask_json; + unsigned http_code = 0; + std::string http_body; + if (m_agent->get_subtask_info(subtask_id, &subtask_json, &http_code, &http_body) == 0) { + try { + json task_j = json::parse(subtask_json); + if (task_j.contains("content")) { + std::string content_str = task_j["content"].get(); + json content_j = json::parse(content_str); + plate_index = content_j["info"]["plate_idx"].get(); + } + + if (task_j.contains("context") && task_j["context"].contains("plates")) { + for (int i = 0; i < task_j["context"]["plates"].size(); i++) { + if (task_j["context"]["plates"][i].contains("index") && task_j["context"]["plates"][i]["index"].get() == plate_index) { + slice_info->thumbnail_url = task_j["context"]["plates"][i]["thumbnail"]["url"].get(); + BOOST_LOG_TRIVIAL(trace) << "task_info: thumbnail url=" << slice_info->thumbnail_url; + } + } + } else { + BOOST_LOG_TRIVIAL(error) << "task_info: no context or plates"; + } + } + catch(...) { + } + } else { + BOOST_LOG_TRIVIAL(error) << "task_info: get subtask id failed!"; + } } if (plate_index >= 0) { @@ -4285,7 +4515,7 @@ void MachineObject::update_slice_info(std::string project_id, std::string profil if (!j["weight"].is_null()) slice_info->weight = j["weight"].get(); if (!j["thumbnail"].is_null()) { - slice_info->thumbnail_url = j["thumbnail"]["url"].get(); + //slice_info->thumbnail_url = j["thumbnail"]["url"].get(); BOOST_LOG_TRIVIAL(trace) << "slice_info: thumbnail url=" << slice_info->thumbnail_url; } if (!j["filaments"].is_null()) { @@ -4479,6 +4709,10 @@ void DeviceManager::on_machine_alive(std::string json_str) if (j.contains("sec_link")) { sec_link = j["sec_link"].get(); } + std::string connection_name = ""; + if (j.contains("connection_name")) { + connection_name = j["connection_name"].get(); + } MachineObject* obj; @@ -4497,11 +4731,24 @@ void DeviceManager::on_machine_alive(std::string json_str) // update properties /* ip changed */ obj = it->second; - if (obj->dev_ip.compare(dev_ip) != 0 && !obj->dev_ip.empty()) { - BOOST_LOG_TRIVIAL(info) << "MachineObject IP changed from " << obj->dev_ip << " to " << dev_ip; - obj->dev_ip = dev_ip; + + if (obj->dev_ip.compare(dev_ip) != 0) { + if ( connection_name.empty() ) { + BOOST_LOG_TRIVIAL(info) << "MachineObject IP changed from " << obj->dev_ip << " to " << dev_ip; + obj->dev_ip = dev_ip; + } + else { + if ( obj->dev_connection_name.empty() || obj->dev_connection_name.compare(connection_name) == 0) { + BOOST_LOG_TRIVIAL(info) << "MachineObject IP changed from " << obj->dev_ip << " to " << dev_ip << " connection_name is " << connection_name; + if(obj->dev_connection_name.empty()){obj->dev_connection_name = connection_name;} + obj->dev_ip = dev_ip; + } + + } /* ip changed reconnect mqtt */ } + + obj->wifi_signal = printer_signal; obj->dev_connection_type= connect_type; obj->bind_state = bind_state; @@ -4529,6 +4776,7 @@ void DeviceManager::on_machine_alive(std::string json_str) obj->dev_connection_type = connect_type; obj->bind_state = bind_state; obj->bind_sec_link = sec_link; + obj->dev_connection_name = connection_name; //load access code AppConfig* config = Slic3r::GUI::wxGetApp().app_config; @@ -4968,6 +5216,21 @@ std::string DeviceManager::get_ftp_folder(std::string type_str) return ""; } +PrinterArch DeviceManager::get_printer_arch(std::string type_str) +{ + PrinterArch arch = PrinterArch::ARCH_CORE_XY; + if (DeviceManager::function_table.contains("printers")) { + for (auto printer : DeviceManager::function_table["printers"]) { + if (printer.contains("model_id") && printer["model_id"].get() == type_str) { + if (printer.contains("printer_arch")) { + return get_printer_arch_by_str(printer["printer_arch"].get()); + } + } + } + } + return arch; +} + std::string DeviceManager::get_printer_thumbnail_img(std::string type_str) { if (DeviceManager::function_table.contains("printers")) { @@ -5029,6 +5292,22 @@ bool DeviceManager::get_bed_temperature_limit(std::string type_str, int &limit) return result; } +bool DeviceManager::get_nozzle_max_temperature(std::string type_str, int& limit) +{ + bool result = false; + if (DeviceManager::function_table.contains("printers")) { + for (auto printer : DeviceManager::function_table["printers"]) { + if (printer.contains("model_id") && printer["model_id"].get() == type_str) { + if (printer.contains("nozzle_max_temperature")) { + limit = printer["nozzle_max_temperature"].get(); + return true; + } + } + } + } + return result; +} + bool DeviceManager::load_functional_config(std::string config_file) { std::ifstream json_file(config_file.c_str()); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 127ca3416..922369461 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -52,6 +52,11 @@ using namespace nlohmann; namespace Slic3r { +enum PrinterArch { + ARCH_CORE_XY, + ARCH_I3, +}; + enum PrinterSeries { SERIES_X1 = 0, SERIES_P1P, @@ -100,10 +105,13 @@ enum PrinterFunction { FUNC_SEND_TO_SDCARD, FUNC_AUTO_SWITCH_FILAMENT, FUNC_CHAMBER_FAN, + FUNC_AUX_FAN, FUNC_EXTRUSION_CALI, + FUNC_PROMPT_SOUND, FUNC_VIRTUAL_TYAY, FUNC_PRINT_ALL, FUNC_FILAMENT_BACKUP, + FUNC_MOTOR_NOISE_CALI, FUNC_MAX }; @@ -166,6 +174,11 @@ enum AmsOptionType { AMS_OP_CALIBRATE_REMAIN }; +enum ManualPaCaliMethod { + PA_LINE = 0, + PA_PATTERN, +}; + class AmsTray { public: AmsTray(std::string tray_id) { @@ -431,6 +444,7 @@ public: float nozzle_diameter { 0.0f }; std::string dev_connection_type; /* lan | cloud */ std::string connection_type() { return dev_connection_type; } + std::string dev_connection_name; /* lan | eth */ void set_dev_ip(std::string ip) {dev_ip = ip;}; bool has_access_right() { return !get_access_code().empty(); } std::string get_ftp_folder(); @@ -446,6 +460,7 @@ public: //PRINTER_TYPE printer_type = PRINTER_3DPrinter_UKNOWN; std::string printer_type; /* model_id */ PrinterSeries get_printer_series() const; + PrinterArch get_printer_arch() const; std::string printer_thumbnail_img; std::string monitor_upgrade_printer_img; @@ -529,6 +544,7 @@ public: bool can_unload_filament(); bool is_U0_firmware(); bool is_support_ams_mapping(); + bool is_support_command_ams_switch(); static bool is_support_ams_mapping_version(std::string module, std::string version); int ams_filament_mapping(std::vector filaments, std::vector &result, std::vector exclude_id = std::vector()); @@ -549,6 +565,7 @@ public: float bed_temp; float bed_temp_target; float chamber_temp; + float chamber_temp_target; float frame_temp; /* cooling */ @@ -562,6 +579,7 @@ public: std::string wifi_signal; std::string link_th; std::string link_ams; + bool network_wired { false }; /* lights */ LIGHT_EFFECT chamber_light; @@ -632,6 +650,7 @@ public: float cache_flow_ratio { 0.0 }; bool cali_finished = true; + ManualPaCaliMethod manual_pa_cali_method = ManualPaCaliMethod::PA_LINE; bool has_get_pa_calib_tab{ false }; std::vector pa_calib_tab; float pa_calib_tab_nozzle_dia; @@ -711,7 +730,9 @@ public: int xcam_buildplate_marker_hold_count = 0; bool xcam_support_recovery_step_loss { true }; bool xcam_auto_recovery_step_loss{ false }; + bool xcam_allow_prompt_sound{ false }; int xcam_auto_recovery_hold_count = 0; + int xcam_prompt_sound_hold_count = 0; int ams_print_option_count = 0; /*not support U2*/ @@ -786,6 +807,7 @@ public: int command_task_resume(); int command_set_bed(int temp); int command_set_nozzle(int temp); + int command_set_chamber(int temp); // ams controls int command_ams_switch(int tray_index, int old_temp = 210, int new_temp = 210); int command_ams_change_filament(int tray_id, int old_temp = 210, int new_temp = 210); @@ -806,15 +828,18 @@ public: // set printing speed int command_set_printing_speed(PrintingSpeedLevel lvl); + //set pormpt sound + int command_set_prompt_sound(bool prompt_sound); + // set print option int command_set_printing_option(bool auto_recovery); // axis string is X, Y, Z, E - int command_axis_control(std::string axis, double unit = 1.0f, double value = 1.0f, int speed = 3000); + int command_axis_control(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000); // calibration printer bool is_support_command_calibration(); - int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali); + int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali, bool motor_noise); // PA calibration int command_start_pa_calibration(const X1CCalibInfos& pa_data, int mode = 0); // 0: automatic mode; 1: manual mode. default: automatic mode @@ -839,6 +864,7 @@ public: int command_xcam_control_first_layer_inspector(bool on_off, bool print_halt); int command_xcam_control_buildplate_marker_detector(bool on_off); int command_xcam_control_auto_recovery_step_loss(bool on_off); + int command_xcam_control_allow_prompt_sound(bool on_off); /* common apis */ inline bool is_local() { return !dev_ip.empty(); } @@ -851,6 +877,7 @@ public: bool is_in_printing(); bool is_in_prepare(); bool is_printing_finished(); + bool is_core_xy(); void reset_update_time(); void reset(); static bool is_in_printing_status(std::string status); @@ -944,11 +971,13 @@ public: static std::string parse_printer_type(std::string type_str); static std::string get_printer_display_name(std::string type_str); static std::string get_printer_thumbnail_img(std::string type_str); + static PrinterArch get_printer_arch(std::string type_str); static std::string get_ftp_folder(std::string type_str); static bool is_function_supported(std::string type_str, std::string function_name); static std::vector get_resolution_supported(std::string type_str); static bool get_bed_temperature_limit(std::string type_str, int& limit); + static bool get_nozzle_max_temperature(std::string type_str, int& limit); static bool load_functional_config(std::string config_file); static bool load_filaments_blacklist_config(std::string config_file); static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info); diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 2488e4e2f..091a60b45 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -66,6 +66,12 @@ wxString double_to_string(double const value, const int max_precision /*= 4*/) return s; } +wxString get_thumbnail_string(const Vec2d& value) +{ + wxString ret_str = wxString::Format("%.2fx%.2f", value[0], value[1]); + return ret_str; +} + wxString get_thumbnails_string(const std::vector& values) { wxString ret_str; @@ -367,6 +373,34 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true m_value = into_u8(str); break; } + case coPoint:{ + Vec2d out_value; + str.Replace(" ", wxEmptyString, true); + if (!str.IsEmpty()) { + bool invalid_val = true; + double x, y; + wxStringTokenizer thumbnail(str, "x"); + if (thumbnail.HasMoreTokens()) { + wxString x_str = thumbnail.GetNextToken(); + if (x_str.ToDouble(&x) && thumbnail.HasMoreTokens()) { + wxString y_str = thumbnail.GetNextToken(); + if (y_str.ToDouble(&y) && !thumbnail.HasMoreTokens()) { + out_value = Vec2d(x, y); + invalid_val = false; + } + } + } + + if (invalid_val) { + wxString text_value; + if (!m_value.empty()) text_value = get_thumbnail_string(boost::any_cast(m_value)); + set_value(text_value, true); + show_error(m_parent, format_wxstr(_L("Invalid format. Expected vector format: \"%1%\""), "XxY, XxY, ...")); + } + } + + m_value = out_value; + break; } case coPoints: { std::vector out_values; @@ -446,7 +480,7 @@ void Field::sys_color_changed() template bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type) { - if (!win || (static_cast(win)->GetValue().empty() && type != coString && type != coStrings && type != coPoints)) + if (!win || (static_cast(win)->GetValue().empty() && type != coString && type != coStrings && type != coPoints && type != coPoint)) return false; return true; } @@ -495,6 +529,9 @@ void TextCtrl::BUILD() { text_value = vec->get_at(m_opt_idx); break; } + case coPoint: + text_value = get_thumbnail_string(m_opt.get_default_value()->value); + break; case coPoints: text_value = get_thumbnails_string(m_opt.get_default_value()->values); break; @@ -1622,8 +1659,11 @@ void PointCtrl::BUILD() auto temp = new wxBoxSizer(wxHORIZONTAL); const wxSize field_size(4 * m_em_unit, -1); - - auto default_pt = m_opt.get_default_value()->values.at(0); + Slic3r::Vec2d default_pt; + if(m_opt.type == coPoints) + default_pt = m_opt.get_default_value()->values.at(0); + else + default_pt = m_opt.get_default_value()->value; double val = default_pt(0); wxString X = val - int(val) == 0 ? wxString::Format(_T("%i"), int(val)) : wxNumberFormatter::ToString(val, 2, wxNumberFormatter::Style_None); val = default_pt(1); @@ -1734,14 +1774,19 @@ void PointCtrl::set_value(const Vec2d& value, bool change_event) void PointCtrl::set_value(const boost::any& value, bool change_event) { Vec2d pt(Vec2d::Zero()); - const Vec2d *ptf = boost::any_cast(&value); - if (!ptf) - { - ConfigOptionPoints* pts = boost::any_cast(value); - pt = pts->values.at(0); - } - else - pt = *ptf; + const Vec2d* ptf = boost::any_cast(&value); + if (!ptf) { + if (m_opt.type == coPoint) { + ConfigOptionPoint* pts = boost::any_cast(value); + pt = pts->value; + } + else { + ConfigOptionPoints* pts = boost::any_cast(value); + pt = pts->values.at(0); + } + } + else + pt = *ptf; set_value(pt, change_event); } diff --git a/src/slic3r/GUI/Field.hpp b/src/slic3r/GUI/Field.hpp index 1a997a8eb..a951c0213 100644 --- a/src/slic3r/GUI/Field.hpp +++ b/src/slic3r/GUI/Field.hpp @@ -38,6 +38,7 @@ using t_change = std::function; wxString double_to_string(double const value, const int max_precision = 4); +wxString get_thumbnail_string(const Vec2d& value); wxString get_thumbnails_string(const std::vector& values); class Field { diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 7184f554d..e68df3e38 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -5379,6 +5379,7 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo std::string bed_shrink_x_key = "bed_shrink_x", bed_shrink_y_key = "bed_shrink_y"; std::string multi_material_key = "allow_multi_materials_on_same_plate"; std::string avoid_extrusion_key = "avoid_extrusion_cali_region"; + std::string align_to_y_axis_key = "align_to_y_axis"; std::string postfix; //BBS: bool seq_print = false; @@ -5394,7 +5395,7 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo //BBS: seq_print = true; } else { - dist_min = 0.1f; + dist_min = 0.0f; postfix = "_fff"; } } @@ -5446,6 +5447,22 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo settings_out.avoid_extrusion_cali_region = false; } + // Align to Y axis. Only enable this option when auto rotation not enabled + { + if (settings_out.enable_rotation) { // do not allow align to Y axis if rotation is enabled + imgui->disabled_begin(true); + settings_out.align_to_y_axis = false; + } + + if (imgui->bbl_checkbox(_L("Align to Y axis"), settings.align_to_y_axis)) { + settings_out.align_to_y_axis = settings.align_to_y_axis; + appcfg->set("arrange", align_to_y_axis_key, settings_out.align_to_y_axis ? "1" : "0"); + settings_changed = true; + } + + if (settings_out.enable_rotation == true) { imgui->disabled_end(); } + } + ImGui::Separator(); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(15.0f, 10.0f)); if (imgui->button(_L("Arrange"))) { @@ -5460,8 +5477,16 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo settings_out.distance = std::max(dist_min, settings_out.distance); //BBS: add specific arrange settings if (seq_print) settings_out.is_seq_print = true; - appcfg->set("arrange", dist_key.c_str(), float_to_string_decimal_point(settings_out.distance)); - appcfg->set("arrange", rot_key.c_str(), settings_out.enable_rotation? "1" : "0"); + + if (auto printer_structure_opt = wxGetApp().preset_bundle->printers.get_edited_preset().config.option>("printer_structure")) { + settings_out.align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3); + } + else + settings_out.align_to_y_axis = false; + + appcfg->set("arrange", dist_key, float_to_string_decimal_point(settings_out.distance)); + appcfg->set("arrange", rot_key, settings_out.enable_rotation ? "1" : "0"); + appcfg->set("arrange", align_to_y_axis_key, settings_out.align_to_y_axis ? "1" : "0"); settings_changed = true; } ImGui::PopStyleVar(1); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index fe99626e5..303a2d04b 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -472,7 +472,7 @@ public: struct ArrangeSettings { - float distance = 5.; + float distance = 0.f; // float distance_sla = 6.; float accuracy = 0.65f; // Unused currently bool enable_rotation = false; @@ -482,6 +482,7 @@ public: bool is_seq_print = false; float bed_shrink_x = 0.f; float bed_shrink_y = 0.f; + bool align_to_y_axis = false; }; struct OrientSettings @@ -624,7 +625,6 @@ private: return *ptr; } - ArrangeSettings &get_arrange_settings() { return get_arrange_settings(this); } //BBS:record key botton frequency @@ -650,6 +650,7 @@ public: } void load_arrange_settings(); + ArrangeSettings& get_arrange_settings() { return get_arrange_settings(this); } class SequentialPrintClearance { diff --git a/src/slic3r/GUI/GUI.cpp b/src/slic3r/GUI/GUI.cpp index 40b4ff123..9d4e39421 100644 --- a/src/slic3r/GUI/GUI.cpp +++ b/src/slic3r/GUI/GUI.cpp @@ -198,6 +198,10 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt config.option(opt_key)->set_at(vec_new, opt_index, 0); } break; + case coPoint:{ + config.set_key_value(opt_key, new ConfigOptionPoint(boost::any_cast(value))); + } + break; case coPoints:{ if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "thumbnails") { config.option(opt_key)->values = boost::any_cast>(value); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 2cadbe892..1f078392f 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -737,7 +737,11 @@ static const FileWildcards file_wildcards_by_type[FT_SIZE] = { /* FT_AMF */ { "AMF files"sv, { ".amf"sv, ".zip.amf"sv, ".xml"sv } }, /* FT_3MF */ { "3MF files"sv, { ".3mf"sv } }, /* FT_GCODE */ { "G-code files"sv, { ".gcode"sv, ".3mf"sv } }, +#ifdef __APPLE__ + /* FT_MODEL */ { "Supported files"sv, { ".3mf"sv, ".stl"sv, ".stp"sv, ".step"sv, ".svg"sv, ".amf"sv, ".obj"sv , ".usd"sv, ".usda"sv, ".usdc"sv, ".usdz"sv, ".abc"sv, ".ply"sv} }, +#else /* FT_MODEL */ {"Supported files"sv, {".3mf"sv, ".stl"sv, ".stp"sv, ".step"sv, ".svg"sv, ".amf"sv, ".obj"sv }}, +#endif /* FT_PROJECT */ { "Project files"sv, { ".3mf"sv} }, /* FT_GALLERY */ { "Known files"sv, { ".stl"sv, ".obj"sv } }, @@ -3001,7 +3005,7 @@ bool GUI_App::has_model_mall() { if (auto cc = app_config->get_country_code(); cc == "CN" || cc == "") return false; - return false; + return true; } void GUI_App::update_label_colours() @@ -3625,7 +3629,11 @@ void GUI_App::import_model(wxWindow *parent, wxArrayString& input_files) const { input_files.Clear(); wxFileDialog dialog(parent ? parent : GetTopWindow(), +#ifdef __APPLE__ + _L("Choose one or more files (3mf/step/stl/svg/obj/amf/usd*/abc/ply):"), +#else _L("Choose one or more files (3mf/step/stl/svg/obj/amf):"), +#endif from_u8(app_config->get_last_dir()), "", file_wildcards(FT_MODEL), wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST); diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 6e2460592..44411b361 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -229,7 +229,7 @@ private: #endif //import model from mall - std::string m_download_file_url; + wxString m_download_file_url; //#ifdef _WIN32 wxColour m_color_label_modified; @@ -627,6 +627,7 @@ private: bool check_networking_version(); void cancel_networking_install(); void restart_networking(); + void check_config_updates_from_updater() { check_updates(false); } private: int updating_bambu_networking(); diff --git a/src/slic3r/GUI/GUI_Factories.cpp b/src/slic3r/GUI/GUI_Factories.cpp index f3a68b260..0cdfb1a3d 100644 --- a/src/slic3r/GUI/GUI_Factories.cpp +++ b/src/slic3r/GUI/GUI_Factories.cpp @@ -500,6 +500,8 @@ wxMenu* MenuFactory::append_submenu_add_generic(wxMenu* menu, ModelVolumeType ty file_name = "ksr_fdmtest_v4.stl"; else if (file_name == L("Voron Cube")) file_name = "Voron_Design_Cube_v7.stl"; + else if (file_name == "Disc") + file_name ="Disc.stl"; else return; input_files.push_back( diff --git a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp index c851535d6..ba9780501 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp @@ -1710,7 +1710,8 @@ bool GLGizmoAdvancedCut::render_combo(const std::string &label, const std::vecto size_t selection_out = selection_idx; - if (ImGui::BBLBeginCombo(("##" + label).c_str(), lines[selection_idx].c_str(), 0)) { + const char* selected_str = (selection_idx >= 0 && selection_idx < int(lines.size())) ? lines[selection_idx].c_str() : ""; + if (ImGui::BBLBeginCombo(("##" + label).c_str(), selected_str, 0)) { for (size_t line_idx = 0; line_idx < lines.size(); ++line_idx) { ImGui::PushID(int(line_idx)); if (ImGui::Selectable("", line_idx == selection_idx)) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp index 907848e50..553b477b3 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp @@ -1002,8 +1002,9 @@ bool GLGizmoText::update_text_positions(const std::vector& texts) Vec3d temp_position = m_mouse_position_world; Vec3d temp_normal = m_mouse_normal_world; - Vec3d cut_plane = Vec3d::UnitY(); - if (temp_normal != Vec3d::UnitZ()) { + Vec3d cut_plane = Vec3d::UnitY(); + double epson = 1e-6; + if (!(abs(temp_normal.x()) <= epson && abs(temp_normal.y()) <= epson && abs(temp_normal.z()) > epson)) { // temp_normal != Vec3d::UnitZ() Vec3d v_plane = temp_normal.cross(Vec3d::UnitZ()); cut_plane = v_plane.cross(temp_normal); } @@ -1092,6 +1093,9 @@ bool GLGizmoText::update_text_positions(const std::vector& texts) MeshSlicingParams slicing_params; slicing_params.trafo = transfo * mi->get_transformation().get_matrix() /** volume->get_transformation().get_matrix()*/; + // for debug + // its_write_obj(slice_meshs.its, "D:/debug_files/mesh.obj"); + // generate polygons const Polygons temp_polys = slice_mesh(slice_meshs.its, click_point.z(), slicing_params); diff --git a/src/slic3r/GUI/HMS.cpp b/src/slic3r/GUI/HMS.cpp index 87c5257a9..2f24569a6 100644 --- a/src/slic3r/GUI/HMS.cpp +++ b/src/slic3r/GUI/HMS.cpp @@ -279,9 +279,22 @@ std::string get_hms_wiki_url(std::string error_code) std::string hms_host = wxGetApp().app_config->get_hms_host(); std::string lang_code = HMSQuery::hms_language_code(); std::string url = (boost::format("https://%1%/index.php?e=%2%&s=device_hms&lang=%3%") + % hms_host + % error_code + % lang_code).str(); + + DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); + if (!dev) return url; + MachineObject* obj = dev->get_selected_machine(); + if (!obj) return url; + + if (!obj->dev_id.empty()) { + url = (boost::format("https://%1%/index.php?e=%2%&d=%3%&s=device_hms&lang=%4%") % hms_host % error_code + % obj->dev_id % lang_code).str(); + } return url; } diff --git a/src/slic3r/GUI/IMSlider.cpp b/src/slic3r/GUI/IMSlider.cpp index 0f7325e18..9f2caaa3e 100644 --- a/src/slic3r/GUI/IMSlider.cpp +++ b/src/slic3r/GUI/IMSlider.cpp @@ -234,7 +234,7 @@ void IMSlider::SetTicksValues(const Info &custom_gcode_per_print_z) m_ticks.ticks.clear(); const std::vector &heights = custom_gcode_per_print_z.gcodes; for (auto h : heights) { - int tick = get_tick_from_value(h.print_z); + int tick = get_tick_from_value(h.print_z, true); if (tick >= 0) m_ticks.ticks.emplace(TickCode{tick, h.type, h.extruder, h.color, h.extra}); } diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.cpp b/src/slic3r/GUI/Jobs/ArrangeJob.cpp index d3cce20bf..745754d7b 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.cpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.cpp @@ -257,7 +257,12 @@ void ArrangeJob::prepare_wipe_tower() // if wipe tower is explicitly disabled, no need to estimate DynamicPrintConfig ¤t_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; auto op = current_config.option("enable_prime_tower"); - if (op && op->getBool() == false || params.is_seq_print) return; + bool enable_prime_tower = op && op->getBool(); + if (!enable_prime_tower || params.is_seq_print) return; + bool smooth_timelapse = false; + auto sop = current_config.option("timelapse_type"); + if (sop) { smooth_timelapse = sop->getInt() == TimelapseType::tlSmooth; } + if (smooth_timelapse) { need_wipe_tower = true; } // estimate if we need wipe tower for all plates: // need wipe tower if some object has multiple extruders (has paint-on colors or support material) @@ -270,7 +275,7 @@ void ArrangeJob::prepare_wipe_tower() break; } } - + // if multile extruders have same bed temp, we need wipe tower // 允许不同材料落在相同盘,且所有选定对象中使用了多种热床温度相同的材料 if (params.allow_multi_materials_on_same_plate) { @@ -287,35 +292,24 @@ void ArrangeJob::prepare_wipe_tower() } BOOST_LOG_TRIVIAL(info) << "arrange: need_wipe_tower=" << need_wipe_tower; - if (need_wipe_tower) { - // check all plates to see if wipe tower is already there - ArrangePolygon wipe_tower_ap; - std::vector plates_have_wipe_tower(MAX_NUM_PLATES, false); - for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) - if (auto wti = get_wipe_tower(*m_plater, bedid)) { - ArrangePolygon &&ap = get_wipetower_arrange_poly(&wti); - wipe_tower_ap = ap; - ap.bed_idx = bedid; - m_unselected.emplace_back(std::move(ap)); - plates_have_wipe_tower[bedid] = true; - } - // if wipe tower is not init yet (no wipe tower in any plate before arrangement) - //if (wipe_tower_ap.poly.empty()) { - // auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); - // wipe_tower_ap.poly.contour.points = print.first_layer_wipe_tower_corners(false); - wipe_tower_ap.name = "WipeTower"; - wipe_tower_ap.is_virt_object = true; - wipe_tower_ap.is_wipe_tower = true; - //} - const GLCanvas3D* canvas3D=static_cast(m_plater->canvas3D()); - for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) { - if (!plates_have_wipe_tower[bedid]) { - wipe_tower_ap.translation = {0, 0}; - wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid, !only_on_partplate); - wipe_tower_ap.bed_idx = bedid; - m_unselected.emplace_back(wipe_tower_ap); - } + // check all plates to see if wipe tower is already there + ArrangePolygon wipe_tower_ap; + wipe_tower_ap.name = "WipeTower"; + wipe_tower_ap.is_virt_object = true; + wipe_tower_ap.is_wipe_tower = true; + const GLCanvas3D *canvas3D = static_cast(m_plater->canvas3D()); + for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) { + if (auto wti = get_wipe_tower(*m_plater, bedid)) { + // wipe tower is already there + wipe_tower_ap = get_wipetower_arrange_poly(&wti); + wipe_tower_ap.bed_idx = bedid; + m_unselected.emplace_back(wipe_tower_ap); + } else if (need_wipe_tower) { + wipe_tower_ap.translation = {0, 0}; + wipe_tower_ap.poly.contour.points = canvas3D->estimate_wipe_tower_points(bedid, !only_on_partplate); + wipe_tower_ap.bed_idx = bedid; + m_unselected.emplace_back(wipe_tower_ap); } } } @@ -395,8 +389,13 @@ void ArrangeJob::prepare() params = init_arrange_params(m_plater); //BBS update extruder params and speed table before arranging - Plater::setExtruderParams(Model::extruderParamsMap); - Plater::setPrintSpeedTable(Model::printSpeedMap); + const Slic3r::DynamicPrintConfig& config = wxGetApp().preset_bundle->full_config(); + auto& print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); + auto print_config = print.config(); + int numExtruders = wxGetApp().preset_bundle->filament_presets.size(); + + Model::setExtruderParams(config, numExtruders); + Model::setPrintSpeedTable(config, print_config); int state = m_plater->get_prepare_state(); if (state == Job::JobPrepareState::PREPARE_STATE_DEFAULT) { @@ -502,17 +501,17 @@ void ArrangeJob::process() const bool is_bbl = wxGetApp().preset_bundle->is_bbl_vendor(); if (is_bbl && params.avoid_extrusion_cali_region && global_config.opt_bool("scan_first_layer")) partplate_list.preprocess_nonprefered_areas(m_unselected, MAX_NUM_PLATES); - - update_arrange_params(params, *m_plater, m_selected); - update_selected_items_inflation(m_selected, *m_plater, params); - update_unselected_items_inflation(m_unselected, *m_plater, params); - Points bedpts = get_shrink_bedpts(*m_plater,params); + update_arrange_params(params, *m_plater, m_selected); + update_selected_items_inflation(m_selected, m_plater->config(), params); + update_unselected_items_inflation(m_unselected, m_plater->config(), params); + update_selected_items_axis_align(m_selected, m_plater->config(), params); + + Points bedpts = get_shrink_bedpts(m_plater->config(),params); double scaled_exclusion_gap = scale_(1); partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scaled_exclusion_gap); - BOOST_LOG_TRIVIAL(debug) << "arrange bed_shrink_x=" << params.bed_shrink_x - << "; bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose(); + BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose(); params.stopcondition = [this]() { return was_canceled(); }; @@ -521,14 +520,14 @@ void ArrangeJob::process() }; { + BOOST_LOG_TRIVIAL(debug)<< "Arrange full params: "<< params.to_json(); BOOST_LOG_TRIVIAL(debug) << "items selected before arrange: "; for (auto selected : m_selected) BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx << ", bed_temp: " << selected.first_bed_temp << ", print_temp: " << selected.print_temp; BOOST_LOG_TRIVIAL(debug) << "items unselected before arrange: "; for (auto item : m_unselected) - if (!item.is_virt_object) - BOOST_LOG_TRIVIAL(debug) << item.name << ", extruder: " << item.extrude_ids.back() << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose(); + BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose(); } arrangement::arrange(m_selected, m_unselected, bedpts, params); @@ -543,9 +542,7 @@ void ArrangeJob::process() << ", trans: " << unscale(selected.translation(X)) << ","<< unscale(selected.translation(Y)); BOOST_LOG_TRIVIAL(debug) << "items unselected after arrange: "; for (auto item : m_unselected) - if (!item.is_virt_object) - BOOST_LOG_TRIVIAL(debug) << item.name << ", extruder: " << item.extrude_ids.back() << ", bed: " << item.bed_idx - << ", trans: " << item.translation.transpose(); + BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose(); } arrangement::arrange(m_unprintable, {}, bedpts, params); @@ -735,18 +732,22 @@ arrangement::ArrangeParams init_arrange_params(Plater *p) arrangement::ArrangeParams params; const GLCanvas3D::ArrangeSettings &settings = static_cast(p->canvas3D())->get_arrange_settings(); auto & print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); + const PrintConfig& print_config = print.config(); + params.clearance_height_to_rod = print.config().extruder_clearance_height_to_rod.value; params.clearance_height_to_lid = print.config().extruder_clearance_height_to_lid.value; params.cleareance_radius = print.config().extruder_clearance_radius.value; params.printable_height = print.config().printable_height.value; params.allow_rotations = settings.enable_rotation; + params.align_center = print_config.best_object_pos.value; params.allow_multi_materials_on_same_plate = settings.allow_multi_materials_on_same_plate; params.avoid_extrusion_cali_region = settings.avoid_extrusion_cali_region; params.is_seq_print = settings.is_seq_print; params.min_obj_distance = scaled(settings.distance); params.bed_shrink_x = settings.bed_shrink_x; params.bed_shrink_y = settings.bed_shrink_y; + params.align_to_y_axis = settings.align_to_y_axis; int state = p->get_prepare_state(); if (state == Job::JobPrepareState::PREPARE_STATE_MENU) { @@ -760,17 +761,15 @@ arrangement::ArrangeParams init_arrange_params(Plater *p) return params; } -//after get selected.call this to update bed_shrink +//after get selected call this to update bed_shrink void update_arrange_params(arrangement::ArrangeParams ¶ms, const Plater &p, const arrangement::ArrangePolygons &selected) { const GLCanvas3D::ArrangeSettings &settings = static_cast(p.canvas3D())->get_arrange_settings(); auto & print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); double skirt_distance = print.has_skirt() ? print.config().skirt_distance.value : 0; - double brim_max = 0; - std::for_each(selected.begin(), selected.end(), [&](const ArrangePolygon &ap) { brim_max = std::max(brim_max, ap.brim_width); }); // Note: skirt_distance is now defined between outermost brim and skirt, not the object and skirt. // So we can't do max but do adding instead. - params.brim_skirt_distance = skirt_distance + brim_max; + params.brim_skirt_distance = skirt_distance; params.bed_shrink_x = settings.bed_shrink_x + params.brim_skirt_distance; params.bed_shrink_y = settings.bed_shrink_y + params.brim_skirt_distance; // for sequential print, we need to inflate the bed because cleareance_radius is so large @@ -781,55 +780,4 @@ void update_arrange_params(arrangement::ArrangeParams ¶ms, const Plater &p, } } -//it will bed accurate after call update_params -Points get_shrink_bedpts(const Plater &plater, const arrangement::ArrangeParams ¶ms) -{ - Points bedpts = get_bed_shape(*plater.config()); - // shrink bed by moving to center by dist - auto shrinkFun = [](Points &bedpts, double dist, int direction) { -#define SGN(x) ((x) >= 0 ? 1 : -1) - Point center = Polygon(bedpts).bounding_box().center(); - for (auto &pt : bedpts) pt[direction] += dist * SGN(center[direction] - pt[direction]); - }; - shrinkFun(bedpts, scaled(params.bed_shrink_x), 0); - shrinkFun(bedpts, scaled(params.bed_shrink_y), 1); - return bedpts; -} - -void update_selected_items_inflation(arrangement::ArrangePolygons &selected, const Plater &p, const arrangement::ArrangeParams ¶ms) { - // do not inflate brim_width. Objects are allowed to have overlapped brim. - Points bedpts = get_shrink_bedpts(p, params); - BoundingBox bedbb = Polygon(bedpts).bounding_box(); - std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon &ap) { - ap.inflation = std::max(scaled(ap.brim_width), params.min_obj_distance / 2); - BoundingBox apbb = ap.poly.contour.bounding_box(); - auto diffx = bedbb.size().x() - apbb.size().x() - 5; - auto diffy = bedbb.size().y() - apbb.size().y() - 5; - if (diffx > 0 && diffy > 0) { - auto min_diff = std::min(diffx, diffy); - ap.inflation = std::min(min_diff / 2, ap.inflation); - } - }); -} - -void update_unselected_items_inflation(arrangement::ArrangePolygons &unselected, const Plater &p, const arrangement::ArrangeParams ¶ms) -{ - if (params.is_seq_print) { - float shift_dist = params.cleareance_radius / 2 - 5; - // dont forget to move the excluded region - for (auto ®ion : unselected) { - if (region.is_virt_object) region.poly.translate(-scaled(shift_dist), -scaled(shift_dist)); - } - } - // For occulusion regions, inflation should be larger to prevent genrating brim on them. - // However, extrusion cali regions are exceptional, since we can allow brim overlaps them. - // 屏蔽区域只需要膨胀brim宽度,防止brim长过去;挤出标定区域不需要膨胀,brim可以长过去。 - // 以前我们认为还需要膨胀clearance_radius/2,这其实是不需要的,因为这些区域并不会真的摆放物体, - // 其他物体的膨胀轮廓是可以跟它们重叠的。 - double scaled_exclusion_gap = scale_(1); - std::for_each(unselected.begin(), unselected.end(), - [&](auto &ap) { ap.inflation = !ap.is_virt_object ? std::max(scaled(ap.brim_width), params.min_obj_distance / 2) - : (ap.is_extrusion_cali_object ? 0 : scaled_exclusion_gap); }); -} - }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Jobs/ArrangeJob.hpp b/src/slic3r/GUI/Jobs/ArrangeJob.hpp index e4ec09b5e..d51822296 100644 --- a/src/slic3r/GUI/Jobs/ArrangeJob.hpp +++ b/src/slic3r/GUI/Jobs/ArrangeJob.hpp @@ -80,14 +80,8 @@ arrangement::ArrangeParams get_arrange_params(Plater *p); arrangement::ArrangeParams init_arrange_params(Plater *p); -Points get_shrink_bedpts(const Plater& plater,const arrangement::ArrangeParams& params); - void update_arrange_params(arrangement::ArrangeParams ¶ms, const Plater &p, const arrangement::ArrangePolygons &selected); -void update_selected_items_inflation(arrangement::ArrangePolygons &selected, const Plater &p, const arrangement::ArrangeParams ¶ms); - -void update_unselected_items_inflation(arrangement::ArrangePolygons &unselected, const Plater &p, const arrangement::ArrangeParams ¶ms); - }} // namespace Slic3r::GUI #endif // ARRANGEJOB_HPP diff --git a/src/slic3r/GUI/Jobs/FillBedJob.cpp b/src/slic3r/GUI/Jobs/FillBedJob.cpp index c767373c9..f96646096 100644 --- a/src/slic3r/GUI/Jobs/FillBedJob.cpp +++ b/src/slic3r/GUI/Jobs/FillBedJob.cpp @@ -206,7 +206,7 @@ void FillBedJob::process() static_cast(m_plater->canvas3D())->get_arrange_settings(); update_arrange_params(params, *m_plater, m_selected); - m_bedpts = get_shrink_bedpts(*m_plater, params); + m_bedpts = get_shrink_bedpts(m_plater->config(), params); auto &partplate_list = m_plater->get_partplate_list(); auto &print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); @@ -216,8 +216,8 @@ void FillBedJob::process() if (is_bbl && params.avoid_extrusion_cali_region && global_config.opt_bool("scan_first_layer")) partplate_list.preprocess_nonprefered_areas(m_unselected, MAX_NUM_PLATES); - update_selected_items_inflation(m_selected, *m_plater, params); - update_unselected_items_inflation(m_unselected, *m_plater, params); + update_selected_items_inflation(m_selected, m_plater->config(), params); + update_unselected_items_inflation(m_unselected, m_plater->config(), params); bool do_stop = false; params.stopcondition = [this, &do_stop]() { diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index 5760bf724..7da188fc1 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -31,7 +31,8 @@ static wxString sending_over_cloud_str = _L("Sending print job through clou PrintJob::PrintJob(std::shared_ptr pri, Plater* plater, std::string dev_id) : PlaterJob{ std::move(pri), plater }, - m_dev_id(dev_id) + m_dev_id(dev_id), + m_is_calibration_task(false) { m_print_job_completed_id = plater->get_print_finished_event(); } @@ -208,7 +209,7 @@ void PrintJob::process() params.filename = job_data._temp_path.string(); params.connection_type = this->connection_type; - result = m_agent->start_send_gcode_to_sdcard(params, nullptr, nullptr); + result = m_agent->start_send_gcode_to_sdcard(params, nullptr, nullptr, nullptr); if (result != 0) { BOOST_LOG_TRIVIAL(error) << "access code is invalid"; m_enter_ip_address_fun_fail(); @@ -280,6 +281,11 @@ void PrintJob::process() if (params.preset_name.empty() && m_print_type == "from_normal") { params.preset_name = wxString::Format("%s_plate_%d", m_project_name, curr_plate_idx).ToStdString(); } if (params.project_name.empty()) {params.project_name = m_project_name;} + if (m_is_calibration_task) { + params.project_name = m_project_name; + params.origin_model_id = ""; + } + wxString error_text; wxString msg_text; @@ -385,6 +391,12 @@ void PrintJob::process() return was_canceled(); }; + auto wait_fn = [this](int state, std::string job_info) { + // TODO + return true; + }; + + if (params.connection_type != "lan") { if (params.dev_ip.empty()) params.comments = "no_ip"; @@ -407,7 +419,7 @@ void PrintJob::process() BOOST_LOG_TRIVIAL(info) << "print_job: use ftp send print only"; this->update_status(curr_percent, _L("Sending print job over LAN")); is_try_lan_mode = true; - result = m_agent->start_local_print_with_record(params, update_fn, cancel_fn); + result = m_agent->start_local_print_with_record(params, update_fn, cancel_fn, wait_fn); if (result < 0) { error_text = wxString::Format("Access code:%s Ip address:%s", params.password, params.dev_ip); // try to send with cloud @@ -423,7 +435,7 @@ void PrintJob::process() // try to send local with record BOOST_LOG_TRIVIAL(info) << "print_job: try to start local print with record"; this->update_status(curr_percent, _L("Sending print job over LAN")); - result = m_agent->start_local_print_with_record(params, update_fn, cancel_fn); + result = m_agent->start_local_print_with_record(params, update_fn, cancel_fn, wait_fn); if (result == 0) { params.comments = ""; } @@ -438,13 +450,13 @@ void PrintJob::process() // try to send with cloud BOOST_LOG_TRIVIAL(warning) << "print_job: try to send with cloud"; this->update_status(curr_percent, _L("Sending print job through cloud service")); - result = m_agent->start_print(params, update_fn, cancel_fn); + result = m_agent->start_print(params, update_fn, cancel_fn, wait_fn); } } else { BOOST_LOG_TRIVIAL(info) << "print_job: send with cloud"; this->update_status(curr_percent, _L("Sending print job through cloud service")); - result = m_agent->start_print(params, update_fn, cancel_fn); + result = m_agent->start_print(params, update_fn, cancel_fn, wait_fn); } } } else { @@ -483,6 +495,8 @@ void PrintJob::process() BOOST_LOG_TRIVIAL(error) << "print_job: failed, result = " << result; } else { + // wait for printer mqtt ready the same job id + wxGetApp().plater()->record_slice_preset("print"); BOOST_LOG_TRIVIAL(error) << "print_job: send ok."; @@ -534,5 +548,9 @@ void PrintJob::connect_to_local_mqtt() this->update_status(0, wxEmptyString); } +void PrintJob::set_calibration_task(bool is_calibration) +{ + m_is_calibration_task = is_calibration; +} }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Jobs/PrintJob.hpp b/src/slic3r/GUI/Jobs/PrintJob.hpp index 97616f4af..8fa902f7d 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.hpp +++ b/src/slic3r/GUI/Jobs/PrintJob.hpp @@ -63,6 +63,8 @@ public: std::string m_print_type; std::string m_dst_path; + bool m_is_calibration_task = false; + int m_print_from_sdc_plate_idx = 0; bool m_local_use_ssl_for_mqtt { true }; @@ -106,6 +108,7 @@ public: void connect_to_local_mqtt(); wxString get_http_error_msg(unsigned int status, std::string body); std::string truncate_string(const std::string& str, size_t maxLength); + void set_calibration_task(bool is_calibration); }; diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index 76af20cc1..ba5dc450b 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -139,7 +139,7 @@ void SendJob::process() params.filename = job_data._temp_path.string(); params.connection_type = this->connection_type; - result = m_agent->start_send_gcode_to_sdcard(params, nullptr, nullptr); + result = m_agent->start_send_gcode_to_sdcard(params, nullptr, nullptr, nullptr); if (result != 0) { BOOST_LOG_TRIVIAL(error) << "access code is invalid"; m_enter_ip_address_fun_fail(); @@ -317,7 +317,7 @@ void SendJob::process() // try to send local with record BOOST_LOG_TRIVIAL(info) << "send_job: try to send gcode to printer"; this->update_status(curr_percent, _L("Sending gcode file over LAN")); - result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn); + result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr); if (result == BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED) { params.comments = "upload_failed"; } else { @@ -335,7 +335,7 @@ void SendJob::process() } else { if (this->has_sdcard) { this->update_status(curr_percent, _L("Sending gcode file over LAN")); - result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn); + result = m_agent->start_send_gcode_to_sdcard(params, update_fn, cancel_fn, nullptr); } else { this->update_status(curr_percent, _L("An SD card needs to be inserted before sending to printer.")); return; diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index eb63f9c6f..9e5540994 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -179,11 +179,11 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ set_miniaturizable(GetHandle()); #endif - //reset developer_mode to false and user_mode to comAdvanced - wxGetApp().app_config->set_bool("developer_mode", false); - if (wxGetApp().app_config->get("user_mode") == "develop") { - wxGetApp().app_config->set("user_mode", "advanced"); - } + if (!wxGetApp().app_config->has("user_mode")) { + wxGetApp().app_config->set("user_mode", "simple"); + wxGetApp().app_config->set_bool("developer_mode", false); + wxGetApp().app_config->save(); + } wxGetApp().app_config->set_bool("internal_developer_mode", false); @@ -1500,7 +1500,7 @@ wxBoxSizer* MainFrame::create_side_tools() m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) { //this->m_plater->select_view_3D("Preview"); - m_plater->update(); + m_plater->update(false, true); if (m_slice_select == eSliceAll) wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL)); else diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index df06b6168..6ab7c46d7 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -153,7 +153,7 @@ void MediaPlayCtrl::Play() m_button_play->SetIcon("media_stop"); NetworkAgent *agent = wxGetApp().getAgent(); std::string agent_version = agent ? agent->get_version() : ""; - if (m_lan_proto > 0 && (m_lan_mode ||!m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { + if (m_lan_proto > 0 && (m_lan_mode || m_lan_proto == 1 || !m_remote_support) && !m_disable_lan && !m_lan_ip.empty()) { m_disable_lan = m_remote_support && !m_lan_mode; // try remote next time if (m_lan_proto == 1) m_url = "bambu:///local/" + m_lan_ip + ".?port=6000&user=" + m_lan_user + "&passwd=" + m_lan_passwd + "&device=" + m_machine + "&version=" + agent_version; @@ -161,7 +161,7 @@ void MediaPlayCtrl::Play() m_url = "bambu:///rtsps___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?device=" + m_machine + "&version=" + agent_version; else if (m_lan_proto == 3) m_url = "bambu:///rtsp___" + m_lan_user + ":" + m_lan_passwd + "@" + m_lan_ip + "/streaming/live/1?device=" + m_machine + "&version=" + agent_version; - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl camera_url: " << m_url; + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << m_url.substr(0, 16); m_last_state = MEDIASTATE_LOADING; SetStatus(_L("Loading...")); if (wxGetApp().app_config->get("internal_developer_mode") == "true") { @@ -207,7 +207,7 @@ void MediaPlayCtrl::Play() url += "&device=" + m; url += "&version=" + v; } - BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl camera_url: " << url << ", machine: " << m_machine; + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl: " << url.substr(0, 16) << ", machine: " << m_machine; CallAfter([this, m, url] { if (m != m_machine) { BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl drop late ttcode for machine: " << m; @@ -263,6 +263,7 @@ void MediaPlayCtrl::Stop(wxString const &msg) } + bool remote = m_url.find("/local/") == wxString::npos && m_url.find("/rtsp") == wxString::npos; if (last_state != wxMEDIASTATE_PLAYING && m_failed_code != 0 && m_last_failed_codes.find(m_failed_code) == m_last_failed_codes.end() && (m_user_triggered || m_failed_retry > 3)) { @@ -273,7 +274,6 @@ void MediaPlayCtrl::Stop(wxString const &msg) j["result"] = "failed"; j["user_triggered"] = m_user_triggered; j["failed_retry"] = m_failed_retry; - bool remote = m_url.find("/local/") == wxString::npos; j["tunnel"] = remote ? "remote" : "local"; j["code"] = m_failed_code; if (remote) @@ -285,7 +285,7 @@ void MediaPlayCtrl::Stop(wxString const &msg) m_url.clear(); ++m_failed_retry; - if (m_failed_code < 0 && last_state != wxMEDIASTATE_PLAYING && (!m_remote_support || m_lan_mode) && (m_failed_retry > 1 || m_user_triggered)) { + if (m_failed_code < 0 && last_state != wxMEDIASTATE_PLAYING && !remote && (m_failed_retry > 1 || m_user_triggered)) { m_next_retry = wxDateTime(); // stop retry if (wxGetApp().show_modal_ip_address_enter_dialog(_L("LAN Connection Failed (Failed to start liveview)"))) { m_failed_retry = 0; @@ -384,7 +384,7 @@ void MediaPlayCtrl::ToggleStream() url += "&device=" + m; url += "&version=" + v; } - BOOST_LOG_TRIVIAL(info) << "camera_url: " << url; + BOOST_LOG_TRIVIAL(info) << "MediaPlayCtrl::ToggleStream: " << url.substr(0, 16); CallAfter([this, m, url] { if (m != m_machine) return; if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) { diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 2e5686c3c..585d5a832 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -1903,7 +1903,7 @@ void NotificationManager::push_slicing_error_notification(const std::string &tex push_notification_data({ NotificationType::SlicingError, NotificationLevel::ErrorNotificationLevel, 0, _u8L("Error:") + "\n" + text, link, callback }, 0); set_slicing_progress_hidden(); } -void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ModelObject const * obj, ObjectID oid, int warning_step, int warning_msg_id) +void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ModelObject const * obj, ObjectID oid, int warning_step, int warning_msg_id, NotificationLevel level/* = NotificationLevel::WarningNotificationLevel*/) { auto callback = obj ? [id = obj->id()](wxEvtHandler *) { auto & objects = wxGetApp().model().objects; @@ -1916,7 +1916,7 @@ void NotificationManager::push_slicing_warning_notification(const std::string& t } : std::function(); auto link = callback ? _u8L("Jump to") : ""; if (obj) link += std::string(" [") + obj->name + "]"; - NotificationData data { NotificationType::SlicingWarning, NotificationLevel::WarningNotificationLevel, 0, _u8L("Warning:") + "\n" + text, link, callback }; + NotificationData data { NotificationType::SlicingWarning, level, 0, _u8L("Warning:") + "\n" + text, link, callback }; data.sub_msg_id = warning_msg_id; data.ori_text = text; @@ -2072,6 +2072,14 @@ void NotificationManager::push_exporting_finished_notification(const std::string set_slicing_progress_hidden(); } +void NotificationManager::push_import_finished_notification(const std::string& path, const std::string& dir_path, bool on_removable) +{ + close_notification_of_type(NotificationType::ExportFinished); + NotificationData data{ NotificationType::ExportFinished, NotificationLevel::RegularNotificationLevel, on_removable ? 0 : 20, _u8L("Model file downloaded.") + "\n" + path }; + push_notification_data(std::make_unique(data, m_id_provider, m_evt_handler, on_removable, path, dir_path), 0); + set_slicing_progress_hidden(); +} + void NotificationManager::push_upload_job_notification(int id, float filesize, const std::string& filename, const std::string& host, float percentage) { // find if upload with same id was not already in notification diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 7127ce30e..021f0446f 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -200,7 +200,7 @@ public: // Creates Slicing Error notification with a custom text and no fade out. void push_slicing_error_notification(const std::string &text, std::vector objs); // Creates Slicing Warning notification with a custom text and no fade out. - void push_slicing_warning_notification(const std::string &text, bool gray, ModelObject const *obj, ObjectID oid, int warning_step, int warning_msg_id); + void push_slicing_warning_notification(const std::string &text, bool gray, ModelObject const *obj, ObjectID oid, int warning_step, int warning_msg_id, NotificationLevel level = NotificationLevel::WarningNotificationLevel); // marks slicing errors as gray void set_all_slicing_errors_gray(bool g); // marks slicing warings as gray @@ -236,6 +236,7 @@ public: void set_sla(bool b) { set_fff(!b); } // Exporting finished, show this information with path, button to open containing folder and if ejectable - eject button void push_exporting_finished_notification(const std::string& path, const std::string& dir_path, bool on_removable); + void push_import_finished_notification(const std::string& path, const std::string& dir_path, bool on_removable); // notifications with progress bar // slicing progress void init_slicing_progress_notification(std::function cancel_callback); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index c1f352a8e..e49d64d48 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -78,6 +78,7 @@ const t_field& OptionsGroup::build_field(const t_config_option_key& id, const Co case coEnums: m_fields.emplace(id, Choice::Create(this->ctrl_parent(), opt, id)); break; + case coPoint: case coPoints: m_fields.emplace(id, PointCtrl::Create(this->ctrl_parent(), opt, id)); break; @@ -1033,6 +1034,9 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config case coEnums: ret = config.opt_int(opt_key, idx); break; + case coPoint: + ret = config.option(opt_key)->value; + break; case coPoints: if (opt_key == "printable_area") ret = config.option(opt_key)->values; @@ -1145,6 +1149,9 @@ boost::any ConfigOptionsGroup::get_config_value2(const DynamicPrintConfig& confi case coEnums: ret = config.opt_int(opt_key, idx); break; + case coPoint: + ret = config.option(opt_key)->value; + break; case coPoints: if (opt_key == "printable_area") ret = config.option(opt_key)->values; diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index 5684c2482..4eece122d 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -2106,7 +2106,7 @@ void PartPlate::duplicate_all_instance(unsigned int dup_count, bool need_skip, s ModelObject* newObj = m_model->add_object(*object); newObj->name = object->name +"_"+ std::to_string(index+1); int new_obj_id = m_model->objects.size() - 1; - for ( size_t new_instance_id = 0; new_instance_id < object->instances.size(); new_instance_id++ ) + for ( size_t new_instance_id = 0; new_instance_id < newObj->instances.size(); new_instance_id++ ) { obj_to_instance_set.emplace(std::pair(new_obj_id, new_instance_id)); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": duplicate object into plate: index_pair [%1%,%2%], obj_id %3%") % new_obj_id % new_instance_id % newObj->id().id; @@ -2115,6 +2115,31 @@ void PartPlate::duplicate_all_instance(unsigned int dup_count, bool need_skip, s } } + for (std::set>::iterator it = obj_to_instance_set.begin(); it != obj_to_instance_set.end(); ++it) + { + int obj_id = it->first; + int instance_id = it->second; + + if ((obj_id >= 0) && (obj_id < m_model->objects.size())) + { + ModelObject* object = m_model->objects[obj_id]; + ModelInstance* instance = object->instances[instance_id]; + + if (instance->printable) + { + instance->loaded_id = instance->id().id; + if (need_skip) { + while (skip_objects.find(instance->loaded_id) != skip_objects.end()) + { + instance->loaded_id ++; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": duplicated id %1% with skip, try new one %2%") %instance->id().id % instance->loaded_id; + } + } + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": set obj %1% instance %2%'s loaded_id to its id %3%, name %4%") % obj_id %instance_id %instance->loaded_id % object->name; + } + } + } + return; } @@ -4518,7 +4543,7 @@ bool PartPlateList::set_shapes(const Pointfs& shape, const Pointfs& exclude_area pos = compute_shape_position(i, m_plate_cols); plate->set_shape(shape, exclude_areas, pos, height_to_lid, height_to_rod); } - + is_load_bedtype_textures = false;//reload textures calc_bounding_boxes(); auto check_texture = [](const std::string& texture) { @@ -4851,6 +4876,8 @@ int PartPlateList::store_to_3mf_structure(PlateDataPtrs& plate_data_list, bool w plate_data_item->gcode_prediction = std::to_string( (int) m_plate_list[i]->get_slice_result()->print_statistics.modes[static_cast(PrintEstimatedStatistics::ETimeMode::Normal)].time); plate_data_item->toolpath_outside = m_plate_list[i]->m_gcode_result->toolpath_outside; + plate_data_item->timelapse_warning_code = m_plate_list[i]->m_gcode_result->timelapse_warning_code; + m_plate_list[i]->set_timelapse_warning_code(plate_data_item->timelapse_warning_code); plate_data_item->is_label_object_enabled = m_plate_list[i]->m_gcode_result->label_object_enabled; Print *print = nullptr; m_plate_list[i]->get_print((PrintBase **) &print, nullptr, nullptr); @@ -4923,6 +4950,8 @@ int PartPlateList::load_from_3mf_structure(PlateDataPtrs& plate_data_list) ps.total_used_filament *= 1000; //koef gcode_result->toolpath_outside = plate_data_list[i]->toolpath_outside; gcode_result->label_object_enabled = plate_data_list[i]->is_label_object_enabled; + gcode_result->timelapse_warning_code = plate_data_list[i]->timelapse_warning_code; + m_plate_list[index]->set_timelapse_warning_code(plate_data_list[i]->timelapse_warning_code); m_plate_list[index]->slice_filaments_info = plate_data_list[i]->slice_filaments_info; gcode_result->warnings = plate_data_list[i]->warnings; if (m_plater && !plate_data_list[i]->thumbnail_file.empty()) { @@ -5054,15 +5083,17 @@ void PartPlateList::BedTextureInfo::TexturePart::update_buffer() void PartPlateList::init_bed_type_info() { - BedTextureInfo::TexturePart pc_part1( 5, 130, 10, 110, "bbl_bed_pc_left.svg"); - BedTextureInfo::TexturePart pc_part2( 74, -12, 150, 12, "bbl_bed_pc_bottom.svg"); - BedTextureInfo::TexturePart ep_part1( 4, 87, 12, 153, "bbl_bed_ep_left.svg"); - BedTextureInfo::TexturePart ep_part2( 72, -11, 150, 12, "bbl_bed_ep_bottom.svg"); - BedTextureInfo::TexturePart pei_part1( 6, 50, 12, 190, "bbl_bed_pei_left.svg"); - BedTextureInfo::TexturePart pei_part2(72, -11, 150, 12, "bbl_bed_pei_bottom.svg"); - BedTextureInfo::TexturePart pte_part1( 6, 40, 12, 200, "bbl_bed_pte_left.svg"); - BedTextureInfo::TexturePart pte_part2(72, -11, 150, 12, "bbl_bed_pte_bottom.svg"); - + BedTextureInfo::TexturePart pc_part1(10, 130, 10, 110, "bbl_bed_pc_left.svg"); + BedTextureInfo::TexturePart pc_part2(74, -10, 148, 12, "bbl_bed_pc_bottom.svg"); + BedTextureInfo::TexturePart ep_part1(7.5, 90, 12.5, 150, "bbl_bed_ep_left.svg"); + BedTextureInfo::TexturePart ep_part2(74, -10, 148, 12, "bbl_bed_ep_bottom.svg"); + BedTextureInfo::TexturePart pei_part1(7.5, 50, 12.5, 190, "bbl_bed_pei_left.svg"); + BedTextureInfo::TexturePart pei_part2(74, -10, 148, 12, "bbl_bed_pei_bottom.svg"); + BedTextureInfo::TexturePart pte_part1(10, 80, 10, 160, "bbl_bed_pte_left.svg"); + BedTextureInfo::TexturePart pte_part2(74, -10, 148, 12, "bbl_bed_pte_bottom.svg"); + for (size_t i = 0; i < btCount; i++) { + bed_texture_info[i].parts.clear(); + } bed_texture_info[btPC].parts.push_back(pc_part1); bed_texture_info[btPC].parts.push_back(pc_part2); bed_texture_info[btEP].parts.push_back(ep_part1); @@ -5072,8 +5103,19 @@ void PartPlateList::init_bed_type_info() bed_texture_info[btPTE].parts.push_back(pte_part1); bed_texture_info[btPTE].parts.push_back(pte_part2); + auto bed_ext = get_extents(m_shape); + int bed_width = bed_ext.size()(0); + int bed_height = bed_ext.size()(1); + float base_width = 256; + float base_height = 256; + float x_rate = bed_width / base_width; + float y_rate = bed_height / base_height; for (int i = 0; i < btCount; i++) { for (int j = 0; j < bed_texture_info[i].parts.size(); j++) { + bed_texture_info[i].parts[j].x *= x_rate; + bed_texture_info[i].parts[j].y *= y_rate; + bed_texture_info[i].parts[j].w *= x_rate; + bed_texture_info[i].parts[j].h *= y_rate; bed_texture_info[i].parts[j].update_buffer(); } } diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index b1bc52171..0b2c693cc 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -144,6 +144,7 @@ private: GLUquadricObject* m_quadric; int m_hover_id; bool m_selected; + int m_timelapse_warning_code = 0; // BBS DynamicPrintConfig m_config; @@ -263,6 +264,9 @@ public: //set the plate's name void set_plate_name(const std::string& name); + void set_timelapse_warning_code(int code) { m_timelapse_warning_code = code; } + int timelapse_warning_code() { return m_timelapse_warning_code; } + //get the print's object, result and index void get_print(PrintBase **print, GCodeResult **result, int *index); @@ -560,16 +564,16 @@ public: class TexturePart { public: // position - int x; - int y; - int w; - int h; + float x; + float y; + float w; + float h; unsigned int vbo_id; std::string filename; GLTexture* texture { nullptr }; Vec2d offset; GeometryBuffer* buffer { nullptr }; - TexturePart(int xx, int yy, int ww, int hh, std::string file) { + TexturePart(float xx, float yy, float ww, float hh, std::string file){ x = xx; y = yy; w = ww; h = hh; filename = file; @@ -799,7 +803,8 @@ public: template void serialize(Archive& ar) { //ar(cereal::base_class(this)); - ar(m_shape, m_plate_width, m_plate_depth, m_plate_height, m_height_to_lid, m_height_to_rod, m_height_limit_mode, m_plate_count, m_current_plate, m_plate_list, unprintable_plate); + //Cancel undo/redo for m_shape ,Because the printing area of different models is different, currently if the grid changes, it cannot correspond to the model on the left ui + ar(m_plate_width, m_plate_depth, m_plate_height, m_height_to_lid, m_height_to_rod, m_height_limit_mode, m_plate_count, m_current_plate, m_plate_list, unprintable_plate); //ar(m_plate_width, m_plate_depth, m_plate_height, m_plate_count, m_current_plate); } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 11e25e462..3919f5881 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -40,6 +40,7 @@ #include #endif #include +#include #include "libslic3r/libslic3r.h" #include "libslic3r/Format/STL.hpp" @@ -174,7 +175,7 @@ wxDEFINE_EVENT(EVT_INSTALL_PLUGIN_HINT, wxCommandEvent); wxDEFINE_EVENT(EVT_PREVIEW_ONLY_MODE_HINT, wxCommandEvent); //BBS: change light/dark mode wxDEFINE_EVENT(EVT_GLCANVAS_COLOR_MODE_CHANGED, SimpleEvent); -//BBS: print +//BBS: print wxDEFINE_EVENT(EVT_PRINT_FROM_SDCARD_VIEW, SimpleEvent); @@ -1451,7 +1452,7 @@ std::map Sidebar::build_filament_ams_list(MachineObject void Sidebar::load_ams_list(std::string const &device, MachineObject* obj) { std::map filament_ams_list = build_filament_ams_list(obj); - + if (!obj) { p->ams_list_device = device; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " clear list"; @@ -2333,6 +2334,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) "enable_support", "support_filament", "support_interface_filament", "support_top_z_distance", "support_bottom_z_distance", "raft_layers", "wipe_tower_rotation_angle", "wipe_tower_cone_angle", "wipe_tower_extra_spacing", "wipe_tower_extruder", + "best_object_pos" })) , sidebar(new Sidebar(q)) , notification_manager(std::make_unique(q)) @@ -2569,7 +2571,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) // update slice and print button wxGetApp().mainframe->update_slice_print_status(MainFrame::SlicePrintEventType::eEventSliceUpdate, true, false); - update(); + set_need_update(true); }); } if (wxGetApp().is_gcode_viewer()) @@ -2807,97 +2809,6 @@ void Plater::priv::select_view(const std::string& direction) assemble_view->select_view(direction); } } -// BBS set print speed table and find maximum speed -void Plater::setPrintSpeedTable(GlobalSpeedMap &printSpeedMap) { - Slic3r::DynamicPrintConfig config = wxGetApp().preset_bundle->full_config(); - printSpeedMap.maxSpeed = 0; - if (config.has("inner_wall_speed")) { - printSpeedMap.perimeterSpeed = config.opt_float("inner_wall_speed"); - if (printSpeedMap.perimeterSpeed > printSpeedMap.maxSpeed) - printSpeedMap.maxSpeed = printSpeedMap.perimeterSpeed; - } - if (config.has("outer_wall_speed")) { - printSpeedMap.externalPerimeterSpeed = config.opt_float("outer_wall_speed"); - printSpeedMap.maxSpeed = std::max(printSpeedMap.maxSpeed, printSpeedMap.externalPerimeterSpeed); - } - if (config.has("sparse_infill_speed")) { - printSpeedMap.infillSpeed = config.opt_float("sparse_infill_speed"); - if (printSpeedMap.infillSpeed > printSpeedMap.maxSpeed) - printSpeedMap.maxSpeed = printSpeedMap.infillSpeed; - } - if (config.has("internal_solid_infill_speed")) { - printSpeedMap.solidInfillSpeed = config.opt_float("internal_solid_infill_speed"); - if (printSpeedMap.solidInfillSpeed > printSpeedMap.maxSpeed) - printSpeedMap.maxSpeed = printSpeedMap.solidInfillSpeed; - } - if (config.has("top_surface_speed")) { - printSpeedMap.topSolidInfillSpeed = config.opt_float("top_surface_speed"); - if (printSpeedMap.topSolidInfillSpeed > printSpeedMap.maxSpeed) - printSpeedMap.maxSpeed = printSpeedMap.topSolidInfillSpeed; - } - if (config.has("support_speed")) { - printSpeedMap.supportSpeed = config.opt_float("support_speed"); - - if (printSpeedMap.supportSpeed > printSpeedMap.maxSpeed) - printSpeedMap.maxSpeed = printSpeedMap.supportSpeed; - } - if (config.has("small_perimeter_speed")) { - printSpeedMap.smallPerimeterSpeed = config.get_abs_value("small_perimeter_speed"); - - if (printSpeedMap.smallPerimeterSpeed > printSpeedMap.maxSpeed) - printSpeedMap.maxSpeed = printSpeedMap.smallPerimeterSpeed; - } - /* "inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed", - "top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed", - "bridge_speed", "gap_infill_speed", "travel_speed", "initial_layer_speed"*/ - - auto& print = wxGetApp().plater()->get_partplate_list().get_current_fff_print(); - auto print_config = print.config(); - printSpeedMap.bed_poly.points = get_bed_shape(*(wxGetApp().plater()->config())); - Pointfs excluse_area_points = print_config.bed_exclude_area.values; - Polygons exclude_polys; - Polygon exclude_poly; - for (int i = 0; i < excluse_area_points.size(); i++) { - auto pt = excluse_area_points[i]; - exclude_poly.points.emplace_back(scale_(pt.x()), scale_(pt.y())); - if (i % 4 == 3) { // exclude areas are always rectangle - exclude_polys.push_back(exclude_poly); - exclude_poly.points.clear(); - } - } - printSpeedMap.bed_poly = diff({ printSpeedMap.bed_poly }, exclude_polys)[0]; -} - -// find temperature of heatend and bed and matierial of an given extruder -void Plater::setExtruderParams(std::map& extParas) { - extParas.clear(); - Slic3r::DynamicPrintConfig config = wxGetApp().preset_bundle->full_config(); - // BBS - int numExtruders = wxGetApp().preset_bundle->filament_presets.size(); - for (unsigned int i = 0; i != numExtruders; ++i) { - std::string matName = ""; - // BBS - int bedTemp = 35; - double endTemp = 0.f; - if (config.has("filament_type")) { - matName = config.opt_string("filament_type", i); - } - if (config.has("nozzle_temperature")) { - endTemp = config.opt_int("nozzle_temperature", i); - } - - // FIXME: curr_bed_type is now a plate config rather than a global config. - // Currently bed temp is not used for brim generation, so just comment it for now. -#if 0 - if (config.has("curr_bed_type")) { - BedType curr_bed_type = config.opt_enum("curr_bed_type"); - bedTemp = config.opt_int(get_bed_temp_key(curr_bed_type), i); - } -#endif - if (i == 0) extParas.insert({ i,{matName, bedTemp, endTemp} }); - extParas.insert({ i + 1,{matName, bedTemp, endTemp} }); - } -} wxColour Plater::get_next_color_for_filament() { @@ -2930,7 +2841,12 @@ wxString Plater::get_slice_warning_string(GCodeProcessorResult::SliceWarning& wa return _L("The bed temperature exceeds filament's vitrification temperature. Please open the front door of printer before printing to avoid nozzle clog."); } else if (warning.msg == NOZZLE_HRC_CHECKER) { return _L("The nozzle hardness required by the filament is higher than the default nozzle hardness of the printer. Please replace the hardened nozzle or filament, otherwise, the nozzle will be attrited or damaged."); - } else { + } else if (warning.msg == NOT_SUPPORT_TRADITIONAL_TIMELAPSE) { + return _L("Enabling traditional timelapse photography may cause surface imperfections. It is recommended to change to smooth mode."); + } else if (warning.msg == NOT_GENERATE_TIMELAPSE) { + return wxString(); + } + else { return wxString(warning.msg); } } @@ -2963,8 +2879,13 @@ void Plater::priv::select_view_3D(const std::string& name, bool no_slice) else if (name == "Preview") { BOOST_LOG_TRIVIAL(info) << "select preview"; //BBS update extruder params and speed table before slicing - Plater::setExtruderParams(Slic3r::Model::extruderParamsMap); - Plater::setPrintSpeedTable(Slic3r::Model::printSpeedMap); + const Slic3r::DynamicPrintConfig& config = wxGetApp().preset_bundle->full_config(); + auto& print = q->get_partplate_list().get_current_fff_print(); + auto print_config = print.config(); + int numExtruders = wxGetApp().preset_bundle->filament_presets.size(); + + Model::setExtruderParams(config, numExtruders); + Model::setPrintSpeedTable(config, print_config); set_current_panel(preview, no_slice); } else if (name == "Assemble") { @@ -4853,7 +4774,7 @@ bool Plater::priv::replace_volume_with_stl(int object_idx, int volume_idx, const Model new_model; try { - new_model = Model::read_from_file(path, nullptr, nullptr, LoadStrategy::AddDefaultInstances); + new_model = Model::read_from_file(path, nullptr, nullptr, LoadStrategy::AddDefaultInstances | LoadStrategy::LoadModel); for (ModelObject* model_object : new_model.objects) { model_object->center_around_origin(); model_object->ensure_on_bed(); @@ -5876,7 +5797,11 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) // Now process state.warnings. for (auto const& warning : state.warnings) { if (warning.current) { - notification_manager->push_slicing_warning_notification(warning.message, false, model_object, object_id, warning_step, warning.message_id); + NotificationManager::NotificationLevel notif_level = NotificationManager::NotificationLevel::WarningNotificationLevel; + if (evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingReplaceInitEmptyLayers | PrintStateBase::SlicingNotificationType::SlicingEmptyGcodeLayers) { + notif_level = NotificationManager::NotificationLevel::SeriousWarningNotificationLevel; + } + notification_manager->push_slicing_warning_notification(warning.message, false, model_object, object_id, warning_step, warning.message_id, notif_level); add_warning(warning, object_id.id); } } @@ -6045,8 +5970,8 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt) } } else { std::vector ptrs; - for (auto oid : message.second) - { + for (auto oid : message.second) + { const PrintObject *print_object = this->background_process.m_fff_print->get_object(ObjectID(oid)); if (print_object) { ptrs.push_back(print_object->model_object()); } } @@ -6258,8 +6183,13 @@ void Plater::priv::on_action_slice_plate(SimpleEvent&) if (q != nullptr) { BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received slice plate event\n" ; //BBS update extruder params and speed table before slicing - Plater::setExtruderParams(Slic3r::Model::extruderParamsMap); - Plater::setPrintSpeedTable(Slic3r::Model::printSpeedMap); + const Slic3r::DynamicPrintConfig& config = wxGetApp().preset_bundle->full_config(); + auto& print = q->get_partplate_list().get_current_fff_print(); + auto print_config = print.config(); + int numExtruders = wxGetApp().preset_bundle->filament_presets.size(); + + Model::setExtruderParams(config, numExtruders); + Model::setPrintSpeedTable(config, print_config); m_slice_all = false; q->reslice(); q->select_view_3D("Preview"); @@ -6272,8 +6202,13 @@ void Plater::priv::on_action_slice_all(SimpleEvent&) if (q != nullptr) { BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received slice project event\n" ; //BBS update extruder params and speed table before slicing - Plater::setExtruderParams(Slic3r::Model::extruderParamsMap); - Plater::setPrintSpeedTable(Slic3r::Model::printSpeedMap); + const Slic3r::DynamicPrintConfig& config = wxGetApp().preset_bundle->full_config(); + auto& print = q->get_partplate_list().get_current_fff_print(); + auto print_config = print.config(); + int numExtruders = wxGetApp().preset_bundle->filament_presets.size(); + + Model::setExtruderParams(config, numExtruders); + Model::setPrintSpeedTable(config, print_config); m_slice_all = true; m_slice_all_only_has_gcode = true; m_cur_slice_plate = 0; @@ -7642,10 +7577,10 @@ void Plater::priv::update_after_undo_redo(const UndoRedo::Snapshot& snapshot, bo // triangle meshes may have gotten released from the scene or the background processing, therefore now being calculated into the Undo / Redo stack size. this->undo_redo_stack().release_least_recently_used(); //YS_FIXME update obj_list from the deserialized model (maybe store ObjectIDs into the tree?) (no selections at this point of time) - get_current_canvas3D()->get_canvas_type() == GLCanvas3D::CanvasAssembleView ? + get_current_canvas3D()->get_canvas_type() == GLCanvas3D::CanvasAssembleView ? assemble_view->get_canvas3d()->get_selection().set_deserialized(GUI::Selection::EMode(this->undo_redo_stack().selection_deserialized().mode), this->undo_redo_stack().selection_deserialized().volumes_and_instances) : this->view3D->get_canvas3d()->get_selection().set_deserialized(GUI::Selection::EMode(this->undo_redo_stack().selection_deserialized().mode), this->undo_redo_stack().selection_deserialized().volumes_and_instances); - get_current_canvas3D()->get_canvas_type() == GLCanvas3D::CanvasAssembleView ? + get_current_canvas3D()->get_canvas_type() == GLCanvas3D::CanvasAssembleView ? assemble_view->get_canvas3d()->get_gizmos_manager().update_after_undo_redo(snapshot) : this->view3D->get_canvas3d()->get_gizmos_manager().update_after_undo_redo(snapshot); @@ -8039,26 +7974,25 @@ int Plater::save_project(bool saveAs) //BBS import model by model id void Plater::import_model_id(wxString download_info) { - //std::string download_origin_url = wxGetApp().url_decode(download_info.ToStdString()); - - std::string download_origin_url = download_info.ToStdString(); - std::string download_url; - std::string filename; + wxString download_origin_url = download_info; + wxString download_url; + wxString filename; + wxString separator = "&name="; try { - std::vector origin_array = wxGetApp().split_str(download_origin_url, "&name="); - if (origin_array.size() >= 2) { + size_t namePos = download_info.Find(separator); + if (namePos != wxString::npos) { + download_url = download_info.Mid(0, namePos); + filename = download_info.Mid(namePos + separator.Length()); - download_url = origin_array[0]; - filename = origin_array[1]; } - else if (!download_origin_url.empty()) { - - fs::path download_path = fs::path(download_origin_url); + else { + fs::path download_path = fs::path(download_origin_url.wx_str()); download_url = download_origin_url; filename = download_path.filename().string(); } + } catch (const std::exception& error) { @@ -8066,7 +8000,8 @@ void Plater::import_model_id(wxString download_info) } bool download_ok = false; - /* save to a file */ + int retry_count = 0; + const int max_retries = 3; /* jump to 3D eidtor */ wxGetApp().mainframe->select_tab((size_t)MainFrame::TabPosition::tp3DEditor); @@ -8094,7 +8029,7 @@ void Plater::import_model_id(wxString download_info) p->project.reset(); /* prepare project and profile */ - boost::thread import_thread = Slic3r::create_thread([&percent, &cont, &cancel, &msg, &target_path, &download_ok, download_url, &filename] { + boost::thread import_thread = Slic3r::create_thread([&percent, &cont, &cancel, &retry_count, max_retries, &msg, &target_path, &download_ok, download_url, &filename] { NetworkAgent* m_agent = Slic3r::GUI::wxGetApp().getAgent(); if (!m_agent) return; @@ -8115,7 +8050,7 @@ void Plater::import_model_id(wxString download_info) try { vecFiles.clear(); - wxString extension = fs::path(filename).extension().c_str(); + wxString extension = fs::path(filename.wx_str()).extension().c_str(); auto name = filename.substr(0, filename.length() - extension.length() - 1); for (const auto& iter : boost::filesystem::directory_iterator(target_path)) @@ -8138,7 +8073,7 @@ void Plater::import_model_id(wxString download_info) //update filename if (is_already_exist && vecFiles.size() >= 1) { - wxString extension = fs::path(filename).extension().c_str(); + wxString extension = fs::path(filename.wx_str()).extension().c_str(); wxString name = filename.substr(0, filename.length() - extension.length()); filename = wxString::Format("%s(%d)%s", name, vecFiles.size() + 1, extension).ToStdString(); } @@ -8158,43 +8093,49 @@ void Plater::import_model_id(wxString download_info) } //target_path /= (boost::format("%1%_%2%.3mf") % filename % unique).str(); - target_path /= fs::path(wxString(filename).wc_str()); + target_path /= fs::path(filename.wc_str()); fs::path tmp_path = target_path; tmp_path += format(".%1%", ".download"); - auto url = download_url; - auto http = Http::get(url); - http.on_progress([&percent, &cont, &msg](Http::Progress progress, bool& cancel) { - if (!cont) cancel = true; - if (progress.dltotal != 0) { - percent = progress.dlnow * 100 / progress.dltotal; - } - msg = wxString::Format(_L("Project downloaded %d%%"), percent); - }) - .on_error([&msg, &cont](std::string body, std::string error, unsigned http_status) { - (void)body; - BOOST_LOG_TRIVIAL(error) << format("Error getting: `%1%`: HTTP %2%, %3%", - body, - http_status, - error); - msg = wxString::Format("Download Failed! body=%s, error=%s, status=%d", body, error, http_status); - cont = false; - return; + + auto http = Http::get(download_url.ToStdString()); + + while (cont && retry_count < max_retries) { + retry_count++; + http.on_progress([&percent, &cont, &msg](Http::Progress progress, bool& cancel) { + if (!cont) cancel = true; + if (progress.dltotal != 0) { + percent = progress.dlnow * 100 / progress.dltotal; + } + msg = wxString::Format(_L("Project downloaded %d%%"), percent); + }) + .on_error([&msg, &cont, &retry_count, max_retries](std::string body, std::string error, unsigned http_status) { + (void)body; + BOOST_LOG_TRIVIAL(error) << format("Error getting: `%1%`: HTTP %2%, %3%", + body, + http_status, + error); + + if (retry_count == max_retries) { + msg = _L("Importing to Bambu Studio failed. Please download the file and manually import it."); + cont = false; + } }) .on_complete([&cont, &download_ok, tmp_path, target_path](std::string body, unsigned /* http_status */) { - fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc); - file.write(body.c_str(), body.size()); - file.close(); - fs::rename(tmp_path, target_path); - cont = false; - download_ok = true; - }) - .perform_sync(); + fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc); + file.write(body.c_str(), body.size()); + file.close(); + fs::rename(tmp_path, target_path); + cont = false; + download_ok = true; + }).perform_sync(); - // for break while - cont = false; - }); + // for break while + //cont = false; + } + + }); while (cont && cont_dlg) { wxMilliSleep(50); @@ -8216,8 +8157,7 @@ void Plater::import_model_id(wxString download_info) if (download_ok) { BOOST_LOG_TRIVIAL(trace) << "import_model_id: target_path = " << target_path.string(); /* load project */ - this->load_project(encode_path(target_path.string().c_str())); - + this->load_project(target_path.wstring()); /*BBS set project info after load project, project info is reset in load project */ //p->project.project_model_id = model_id; //p->project.project_design_id = design_id; @@ -8227,10 +8167,15 @@ void Plater::import_model_id(wxString download_info) } // show save new project - p->set_project_filename(wxString(filename)); + p->set_project_filename(filename); + p->notification_manager->push_import_finished_notification(target_path.string(), target_path.parent_path().string(), false); } else { - if (!msg.empty()) wxMessageBox(msg); + if (!msg.empty()) { + MessageDialog msg_wingow(nullptr, msg, wxEmptyString, wxICON_WARNING | wxOK); + msg_wingow.SetSize(wxSize(FromDIP(480), -1)); + msg_wingow.ShowModal(); + } return; } } @@ -9598,16 +9543,17 @@ void Plater::add_file() } } -void Plater::update(bool conside_update_flag) +void Plater::update(bool conside_update_flag, bool force_background_processing_update) { + unsigned int flag = force_background_processing_update ? (unsigned int)Plater::priv::UpdateParams::FORCE_BACKGROUND_PROCESSING_UPDATE : 0; if (conside_update_flag) { if (need_update()) { - p->update(); + p->update(flag); p->set_need_update(false); } } else - p->update(); + p->update(flag); } void Plater::object_list_changed() { p->object_list_changed(); } @@ -11085,7 +11031,7 @@ void Plater::print_job_finished(wxCommandEvent &evt) p->enter_prepare_mode(); } - + Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return; @@ -11220,7 +11166,7 @@ void Plater::on_filaments_change(size_t num_filaments) for (int i = 0; i < plate_list.get_plate_count(); ++i) { PartPlate* part_plate = plate_list.get_plate(i); part_plate->update_first_layer_print_sequence(num_filaments); - } + } for (ModelObject* mo : wxGetApp().model().objects) { for (ModelVolume* mv : mo->volumes) { @@ -11481,7 +11427,7 @@ void Plater::update_print_error_info(int code, std::string msg, std::string extr if (p->main_frame->m_calibration) p->main_frame->m_calibration->update_print_error_info(code, msg, extra); } - + wxString Plater::get_project_filename(const wxString& extension) const { return p->get_project_filename(extension); @@ -12299,7 +12245,7 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi if (!ret) { PlateNameEditDialog dlg(this, wxID_ANY, _L("Edit Plate Name")); PartPlate * curr_plate = p->partplate_list.get_curr_plate(); - + wxString curr_plate_name = from_u8(curr_plate->get_plate_name()); dlg.set_plate_name(curr_plate_name); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 11d94c658..62c505f5a 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -259,9 +259,7 @@ public: void update_all_plate_thumbnails(bool force_update = false); void invalid_all_plate_thumbnails(); void force_update_all_plate_thumbnails(); - //BBS static functions that update extruder params and speed table - static void setPrintSpeedTable(Slic3r::GlobalSpeedMap& printSpeedMap); - static void setExtruderParams(std::map& extParas); + static wxColour get_next_color_for_filament(); static wxString get_slice_warning_string(GCodeProcessorResult::SliceWarning& warning); @@ -274,7 +272,7 @@ public: const wxString& get_last_loaded_gcode() const { return m_last_loaded_gcode; } - void update(bool conside_update_flag = false); + void update(bool conside_update_flag = false, bool force_background_processing_update = false); //BBS void object_list_changed(); void stop_jobs(); @@ -292,7 +290,7 @@ public: bool is_view3D_overhang_shown() const; void show_view3D_overhang(bool show); - + bool is_sidebar_collapsed() const; void collapse_sidebar(bool show); diff --git a/src/slic3r/GUI/PrintOptionsDialog.cpp b/src/slic3r/GUI/PrintOptionsDialog.cpp index 1f71f7cef..04106abc6 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.cpp +++ b/src/slic3r/GUI/PrintOptionsDialog.cpp @@ -55,6 +55,12 @@ PrintOptionsDialog::PrintOptionsDialog(wxWindow* parent) } evt.Skip(); }); + m_cb_sup_sound->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent& evt) { + if (obj) { + obj->command_xcam_control_allow_prompt_sound(m_cb_sup_sound->GetValue()); + } + evt.Skip(); + }); wxGetApp().UpdateDlgDarkUI(this); } @@ -131,14 +137,23 @@ void PrintOptionsDialog::update_options(MachineObject* obj_) m_cb_auto_recovery->Hide(); line4->Hide(); } + if (obj_->is_function_supported(PrinterFunction::FUNC_PROMPT_SOUND)) { + text_sup_sound->Show(); + m_cb_sup_sound->Show(); + line5->Show(); + } + else { + text_sup_sound->Hide(); + m_cb_sup_sound->Hide(); + line5->Hide(); + } this->Freeze(); - auto test1 = obj_->xcam_first_layer_inspector; - auto test2 = obj_->xcam_buildplate_marker_detector; - auto test3 = obj_->xcam_auto_recovery_step_loss; + m_cb_first_layer->SetValue(obj_->xcam_first_layer_inspector); m_cb_plate_mark->SetValue(obj_->xcam_buildplate_marker_detector); m_cb_auto_recovery->SetValue(obj_->xcam_auto_recovery_step_loss); + m_cb_sup_sound->SetValue(obj_->xcam_allow_prompt_sound); m_cb_ai_monitoring->SetValue(obj_->xcam_ai_monitoring); for (auto i = AiMonitorSensitivityLevel::LOW; i < LEVELS_NUM; i = (AiMonitorSensitivityLevel) (i + 1)) { @@ -256,6 +271,22 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent) sizer->Add(line4, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20)); sizer->Add(0,0,0,wxTOP, FromDIP(20)); + //Allow prompt sound + line_sizer = new wxBoxSizer(wxHORIZONTAL); + m_cb_sup_sound = new CheckBox(parent); + text_sup_sound = new wxStaticText(parent, wxID_ANY, _L("Allow Prompt Sound")); + text_sup_sound->SetFont(Label::Body_14); + line_sizer->Add(FromDIP(5), 0, 0, 0); + line_sizer->Add(m_cb_sup_sound, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5)); + line_sizer->Add(text_sup_sound, 1, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5)); + sizer->Add(0, 0, 0, wxTOP, FromDIP(15)); + sizer->Add(line_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(18)); + line_sizer->Add(FromDIP(5), 0, 0, 0); + + line5 = new StaticLine(parent, false); + line5->SetLineColour(STATIC_BOX_LINE_COL); + sizer->Add(line5, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(20)); + ai_monitoring_level_list->Connect( wxEVT_COMBOBOX, wxCommandEventHandler(PrintOptionsDialog::set_ai_monitor_sensitivity), NULL, this ); return sizer; diff --git a/src/slic3r/GUI/PrintOptionsDialog.hpp b/src/slic3r/GUI/PrintOptionsDialog.hpp index e9221ef7f..e348d64fa 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.hpp +++ b/src/slic3r/GUI/PrintOptionsDialog.hpp @@ -26,6 +26,7 @@ protected: CheckBox* m_cb_ai_monitoring; CheckBox* m_cb_plate_mark; CheckBox* m_cb_auto_recovery; + CheckBox* m_cb_sup_sound; wxStaticText* text_first_layer; wxStaticText* text_ai_monitoring; wxStaticText* text_ai_monitoring_caption; @@ -33,10 +34,12 @@ protected: wxStaticText* text_plate_mark; wxStaticText* text_plate_mark_caption; wxStaticText* text_auto_recovery; + wxStaticText* text_sup_sound; StaticLine* line1; StaticLine* line2; StaticLine* line3; StaticLine* line4; + StaticLine* line5; wxBoxSizer* create_settings_group(wxWindow* parent); bool print_halt = false; diff --git a/src/slic3r/GUI/Project.cpp b/src/slic3r/GUI/Project.cpp index 814040f52..1d6e535bd 100644 --- a/src/slic3r/GUI/Project.cpp +++ b/src/slic3r/GUI/Project.cpp @@ -310,11 +310,18 @@ std::map> ProjectPanel::Reload(wxString aux_path) pfile_obj["filename"] = wxGetApp().url_encode(file_path_obj.filename().string().c_str()); pfile_obj["size"] = formatBytes((unsigned long)filelen); + std::string file_extension = file_path_obj.extension().string(); + boost::algorithm::to_lower(file_extension); + //image - if (file_path_obj.extension() == ".jpg" || - file_path_obj.extension() == ".jpeg" || - file_path_obj.extension() == ".png" || - file_path_obj.extension() == ".bmp") + if (file_extension == ".jpg" || + file_extension == ".jpeg" || + file_extension == ".pjpeg" || + file_extension == ".png" || + file_extension == ".jfif" || + file_extension == ".pjp" || + file_extension == ".webp" || + file_extension == ".bmp") { wxString base64_str = to_base64(file_path); @@ -343,25 +350,29 @@ std::string ProjectPanel::formatBytes(unsigned long bytes) wxString ProjectPanel::to_base64(std::string file_path) { - std::map base64_format; - base64_format[".jpg"] = wxBITMAP_TYPE_JPEG; - base64_format[".jpeg"] = wxBITMAP_TYPE_JPEG; - base64_format[".png"] = wxBITMAP_TYPE_PNG; - base64_format[".bmp"] = wxBITMAP_TYPE_BMP; + std::ifstream imageFile(encode_path(file_path.c_str()), std::ios::binary); + if (!imageFile) { + return wxEmptyString; + } - std::string extension = file_path.substr(file_path.rfind("."), file_path.length()); + std::ostringstream imageStream; + imageStream << imageFile.rdbuf(); - auto image = new wxImage(encode_path(file_path.c_str())); - wxMemoryOutputStream mem; - image->SaveFile(mem, base64_format[extension]); + std::string binaryImageData = imageStream.str(); + + std::string extension; + size_t last_dot = file_path.find_last_of("."); + + if (last_dot != std::string::npos) { + extension = file_path.substr(last_dot + 1); + } + + wxString bease64_head = wxString::Format("data:image/%s;base64,", extension); - wxString km = wxBase64Encode(mem.GetOutputStreamBuffer()->GetBufferStart(), - mem.GetSize()); std::wstringstream wss; - wss << L"data:image/jpg;base64,"; - //wss << wxBase64Encode(km.data(), km.size()); - wss << km; + wss << bease64_head; + wss << wxBase64Encode(binaryImageData.data(), binaryImageData.size()); wxString base64_str = wss.str(); return base64_str; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 706324f21..59cecca28 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -225,14 +225,14 @@ void MachineObjectPanel::doRender(wxDC &dc) } auto sizet = dc.GetTextExtent(dev_name); auto text_end = 0; - + if (m_show_edit) { text_end = size.x - m_unbind_img.GetBmpSize().x - 30; } else { text_end = size.x - m_unbind_img.GetBmpSize().x; } - + wxString finally_name = dev_name; if (sizet.x > (text_end - left)) { auto limit_width = text_end - left - dc.GetTextExtent("...").x - 15; @@ -268,7 +268,7 @@ void MachineObjectPanel::doRender(wxDC &dc) dc.DrawBitmap(m_edit_name_img.bmp(), left, (size.y - m_edit_name_img.GetBmpSize().y) / 2); } } - + } void MachineObjectPanel::update_machine_info(MachineObject *info, bool is_my_devices) @@ -867,14 +867,16 @@ void SelectMachinePopup::OnLeftUp(wxMouseEvent &event) static wxString MACHINE_BED_TYPE_STRING[BED_TYPE_COUNT] = { //_L("Auto"), _L("Bambu Cool Plate") + " / " + _L("PLA Plate"), - _L("Bamabu Engineering Plate"), - _L("Bamabu High Temperature Plate")}; + _L("Bambu Engineering Plate"), + _L("Bambu Smooth PEI Plate") + "/" + _L("High temperature Plate"), + _L("Bambu Textured PEI Plate")}; static std::string MachineBedTypeString[BED_TYPE_COUNT] = { //"auto", "pc", - "pei", "pe", + "pei", + "pte", }; void SelectMachineDialog::stripWhiteSpace(std::string& str) @@ -1205,7 +1207,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_prepare->Add(0, 0, 1, wxTOP, FromDIP(12)); auto hyperlink_sizer = new wxBoxSizer( wxHORIZONTAL ); - m_hyperlink = new wxHyperlinkCtrl(m_panel_prepare, wxID_ANY, _L("Can't connect to the printer"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); + m_hyperlink = new wxHyperlinkCtrl(m_panel_prepare, wxID_ANY, _L("Click here if you can't connect to the printer"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE); hyperlink_sizer->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5); m_sizer_prepare->Add(hyperlink_sizer, 0, wxALIGN_CENTER | wxALL, 5); @@ -1297,7 +1299,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_st_txt_error_desc = new Label(m_sw_print_failed_info, wxEmptyString); st_title_error_desc->SetForegroundColour(0x909090); st_title_error_desc_doc->SetForegroundColour(0x909090); - m_st_txt_error_desc->SetForegroundColour(0x909090); + m_st_txt_error_desc->SetForegroundColour(0x909090); st_title_error_desc->SetFont(::Label::Body_13); st_title_error_desc_doc->SetFont(::Label::Body_13); m_st_txt_error_desc->SetFont(::Label::Body_13); @@ -1314,7 +1316,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_st_txt_extra_info = new Label(m_sw_print_failed_info, wxEmptyString); st_title_extra_info->SetForegroundColour(0x909090); st_title_extra_info_doc->SetForegroundColour(0x909090); - m_st_txt_extra_info->SetForegroundColour(0x909090); + m_st_txt_extra_info->SetForegroundColour(0x909090); st_title_extra_info->SetFont(::Label::Body_13); st_title_extra_info_doc->SetFont(::Label::Body_13); m_st_txt_extra_info->SetFont(::Label::Body_13); @@ -1369,7 +1371,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(11)); m_sizer_main->Add(m_statictext_printer_msg, 0, wxALIGN_CENTER_HORIZONTAL, 0); m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(16)); - m_sizer_main->Add(m_sizer_select, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(40)); + m_sizer_main->Add(m_sizer_select, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT, FromDIP(30)); m_sizer_main->Add(0, 1, 0, wxTOP, FromDIP(10)); m_sizer_main->Add(m_line_schedule, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30)); m_sizer_main->Add(m_simplebook, 0, wxALIGN_CENTER_HORIZONTAL, 0); @@ -1440,7 +1442,7 @@ void SelectMachineDialog::init_bind() } } } - }); + }); m_bitmap_last_plate->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { if (m_print_plate_idx > 0) { @@ -1541,10 +1543,10 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par sizer_checkbox->Add(text, 0, wxALIGN_CENTER, 0); enable_ams = new ScalableBitmap(this, "enable_ams", 16); - auto img_ams_tip = new wxStaticBitmap(checkbox, wxID_ANY, enable_ams->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); + img_ams_tip = new wxStaticBitmap(checkbox, wxID_ANY, enable_ams->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); sizer_checkbox->Add(img_ams_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5)); - img_ams_tip->Bind(wxEVT_ENTER_WINDOW, [this, img_ams_tip](auto& e) { + img_ams_tip->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { wxPoint img_pos = img_ams_tip->ClientToScreen(wxPoint(0, 0)); wxPoint popup_pos(img_pos.x, img_pos.y + img_ams_tip->GetRect().height); m_mapping_tip_popup.Position(popup_pos, wxSize(0, 0)); @@ -1561,7 +1563,6 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par img_ams_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { m_mapping_tip_popup.Dismiss(); }); - ams_tip = img_ams_tip; checkbox->SetSizer(sizer_checkbox); checkbox->Layout(); @@ -1637,7 +1638,7 @@ wxWindow *SelectMachineDialog::create_item_checkbox(wxString title, wxWindow *pa config->set_str("print", param, "0"); } }); - + text->Bind(wxEVT_LEFT_DOWN, [this, check, param](wxMouseEvent &) { //if (!m_checkbox_state_list[param]) {return;} check->SetValue(check->GetValue() ? false : true); @@ -1673,15 +1674,17 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj) && obj->is_support_print_with_timelapse() && is_show_timelapse()) { select_timelapse->Show(); + update_timelapse_enable_status(); } else { select_timelapse->Hide(); } m_sizer_select->Layout(); + Layout(); Fit(); } -void SelectMachineDialog::prepare_mode() +void SelectMachineDialog::prepare_mode(bool refresh_button) { // disable combobox m_comboBox_printer->Enable(); @@ -1696,7 +1699,9 @@ void SelectMachineDialog::prepare_mode() if (wxIsBusy()) wxEndBusyCursor(); - Enable_Send_Button(true); + if (refresh_button) { + Enable_Send_Button(true); + } m_status_bar->reset(); if (m_simplebook->GetSelection() != 0) { @@ -1726,7 +1731,7 @@ void SelectMachineDialog::sending_mode() Fit(); } - + if (m_print_page_mode != PrintPageModeSending) { m_print_page_mode = PrintPageModeSending; for (auto it = m_materialList.begin(); it != m_materialList.end(); it++) { @@ -2014,12 +2019,6 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vectorEnable(); - // m_panel_warn m_simplebook - if (status == PrintDialogStatus::PrintStatusSending) { - sending_mode(); - } else { - prepare_mode(); - } // other if (status == PrintDialogStatus::PrintStatusInit) { @@ -2161,6 +2160,30 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vectorget_partplate_list().get_curr_plate(); + for (auto warning : plate->get_slice_result()->warnings) { + if (warning.msg == NOT_GENERATE_TIMELAPSE) { + if (warning.error_code == "1001C001") { + msg_text = _L("When enable spiral vase mode, machines with I3 structure will not generate timelapse videos."); + } + else if (warning.error_code == "1001C002") { + msg_text = _L("When print by object, machines with I3 structure will not generate timelapse videos."); + } + } + } + update_print_status_msg(msg_text, true, true); + Enable_Send_Button(true); + Enable_Refresh_Button(true); + } + + // m_panel_warn m_simplebook + if (status == PrintDialogStatus::PrintStatusSending) { + sending_mode(); + } + else { + prepare_mode(false); } } @@ -2260,14 +2283,23 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) PartPlate* plate = m_plater->get_partplate_list().get_curr_plate(); - + for (auto warning : plate->get_slice_result()->warnings) { if (warning.msg == BED_TEMP_TOO_HIGH_THAN_FILAMENT) { - if ((obj_->printer_type == "BL-P001" || obj_->printer_type == "BL-P002")) { + if ((obj_->get_printer_series() == PrinterSeries::SERIES_X1)) { confirm_text.push_back(Plater::get_slice_warning_string(warning) + "\n"); has_slice_warnings = true; } } + else if (warning.msg == NOT_SUPPORT_TRADITIONAL_TIMELAPSE) { + if (obj_->get_printer_arch() == PrinterArch::ARCH_I3 && m_checkbox_list["timelapse"]->GetValue()) { + confirm_text.push_back(Plater::get_slice_warning_string(warning) + "\n"); + has_slice_warnings = true; + } + } + else if (warning.msg == NOT_GENERATE_TIMELAPSE) { + continue; + } else { wxString error_info = Plater::get_slice_warning_string(warning); if (error_info.IsEmpty()) { @@ -2345,7 +2377,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) else { this->on_send_print(); } - + }); confirm_text.push_back(_L("Please click the confirm button if you still want to proceed with printing.") + "\n"); @@ -2939,7 +2971,6 @@ void SelectMachineDialog::on_timer(wxTimerEvent &event) if (!obj_ || obj_->amsList.empty() || obj_->ams_exist_bits == 0 - || !obj_->m_is_support_show_bak || !obj_->ams_support_auto_switch_filament_flag || !obj_->ams_auto_switch_filament_flag || !obj_->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP) @@ -3028,6 +3059,8 @@ void SelectMachineDialog::update_ams_check(MachineObject* obj) && obj->ams_support_use_ams && obj->has_ams()) { select_use_ams->Show(); + if (obj->printer_type == "N1") {img_ams_tip->Hide();} + else {img_ams_tip->Show();} } else { select_use_ams->Hide(); } @@ -3144,7 +3177,7 @@ void SelectMachineDialog::update_show_status() } } - if (is_blocking_printing()) { + if (m_print_type == PrintFromType::FROM_NORMAL && is_blocking_printing()) { show_status(PrintDialogStatus::PrintStatusUnsupportedPrinter); return; } @@ -3173,6 +3206,11 @@ void SelectMachineDialog::update_show_status() } } + if (has_timelapse_warning()) { + show_status(PrintDialogStatus::PrintStatusTimelapseWarning); + return; + } + // no ams if (!obj_->has_ams() || !m_checkbox_list["use_ams"]->GetValue()) { if (!has_tips(obj_)) @@ -3239,6 +3277,35 @@ void SelectMachineDialog::update_show_status() } } +bool SelectMachineDialog::has_timelapse_warning() +{ + PartPlate *plate = m_plater->get_partplate_list().get_curr_plate(); + for (auto warning : plate->get_slice_result()->warnings) { + if (warning.msg == NOT_GENERATE_TIMELAPSE) { + return true; + } + } + + return false; +} + +void SelectMachineDialog::update_timelapse_enable_status() +{ + AppConfig *config = wxGetApp().app_config; + if (!has_timelapse_warning()) { + if (!config || config->get("print", "timelapse") == "0") + m_checkbox_list["timelapse"]->SetValue(false); + else + m_checkbox_list["timelapse"]->SetValue(true); + select_timelapse->Enable(true); + } else { + m_checkbox_list["timelapse"]->SetValue(false); + select_timelapse->Enable(false); + if (config) { config->set_str("print", "timelapse", "0"); } + } +} + + bool SelectMachineDialog::is_show_timelapse() { auto compare_version = [](const std::string &version1, const std::string &version2) -> bool { @@ -3342,7 +3409,7 @@ void SelectMachineDialog::on_dpi_changed(const wxRect &suggested_rect) enable_ams_mapping->msw_rescale(); amsmapping_tip->SetBitmap(enable_ams_mapping->bmp()); enable_ams->msw_rescale(); - ams_tip->SetBitmap(enable_ams->bmp()); + img_ams_tip->SetBitmap(enable_ams->bmp()); m_button_refresh->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE); m_button_refresh->SetCornerRadius(FromDIP(12)); @@ -3350,11 +3417,11 @@ void SelectMachineDialog::on_dpi_changed(const wxRect &suggested_rect) m_button_ensure->SetCornerRadius(FromDIP(12)); m_status_bar->msw_rescale(); - for (auto checkpire : m_checkbox_list) { + for (auto checkpire : m_checkbox_list) { checkpire.second->Rescale(); } - for (auto material1 : m_materialList) { + for (auto material1 : m_materialList) { material1.second->item->msw_rescale(); } @@ -3435,7 +3502,7 @@ void SelectMachineDialog::set_default() filename = m_plater->get_export_gcode_filename("", true); if (filename.empty()) filename = _L("Untitled"); } - + fs::path filename_path(filename.c_str()); m_current_project_name = wxString::FromUTF8(filename_path.filename().string()); @@ -3531,7 +3598,7 @@ void SelectMachineDialog::set_default_normal() std::vector materials; std::vector brands; std::vector display_materials; - + auto preset_bundle = wxGetApp().preset_bundle; for (auto filament_name : preset_bundle->filament_presets) { for (auto iter = preset_bundle->filaments.lbegin(); iter != preset_bundle->filaments.end(); iter++) { @@ -3549,7 +3616,7 @@ void SelectMachineDialog::set_default_normal() } } - //init MaterialItem + //init MaterialItem auto extruders = wxGetApp().plater()->get_partplate_list().get_curr_plate()->get_used_extruders(); BitmapCache bmcache; @@ -3716,8 +3783,8 @@ void SelectMachineDialog::set_default_from_sdcard() materials.push_back(fo.type); brands.push_back(fo.brand); } - - //init MaterialItem + + //init MaterialItem MaterialHash::iterator iter = m_materialList.begin(); while (iter != m_materialList.end()) { int id = iter->first; @@ -3732,7 +3799,7 @@ void SelectMachineDialog::set_default_from_sdcard() m_materialList.clear(); m_filaments.clear(); - + for (auto i = 0; i < m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info.size(); i++) { FilamentInfo fo = m_required_data_plate_data_list[m_print_plate_idx]->slice_filaments_info[i]; @@ -3900,7 +3967,7 @@ bool SelectMachineDialog::Show(bool show) if (obj_->is_connected()) { obj_->disconnect(); } - + } } } diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index d49f29fd3..168092fb6 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -272,7 +272,8 @@ enum PrintDialogStatus { PrintStatusNotSupportedSendToSDCard, PrintStatusNotSupportedPrintAll, PrintStatusBlankPlate, - PrintStatusUnsupportedPrinter + PrintStatusUnsupportedPrinter, + PrintStatusTimelapseWarning }; std::string get_print_status_info(PrintDialogStatus status); @@ -385,7 +386,7 @@ protected: ScalableBitmap * print_weight{nullptr}; wxStaticBitmap * amsmapping_tip{nullptr}; ScalableBitmap * enable_ams_mapping{nullptr}; - wxStaticBitmap * ams_tip{nullptr}; + wxStaticBitmap * img_ams_tip{nullptr}; wxStaticBitmap * img_ams_backup{nullptr}; ScalableBitmap * enable_ams{nullptr}; @@ -400,7 +401,7 @@ public: void check_fcous_state(wxWindow* window); void popup_filament_backup(); void update_select_layout(MachineObject *obj); - void prepare_mode(); + void prepare_mode(bool refresh_button = true); void sending_mode(); void finish_mode(); void sync_ams_mapping_result(std::vector& result); @@ -443,6 +444,8 @@ public: void update_print_error_info(int code, std::string msg, std::string extra); void set_flow_calibration_state(bool state); bool is_show_timelapse(); + bool has_timelapse_warning(); + void update_timelapse_enable_status(); bool is_same_printer_model(); bool is_blocking_printing(); bool has_tips(MachineObject* obj); diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index aa6e3ad0a..916194443 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -15,6 +15,9 @@ #include "RecenterDialog.hpp" #include "CalibUtils.hpp" +#include +#include +#include namespace Slic3r { namespace GUI { @@ -30,6 +33,7 @@ static const wxFont SWITCH_FONT = Label::Body_10; /* const values */ static const int bed_temp_range[2] = {20, 120}; static const int nozzle_temp_range[2] = {20, 300}; +static const int nozzle_chamber_range[2] = {20, 60}; /* colors */ static const wxColour STATUS_PANEL_BG = wxColour(238, 238, 238); @@ -83,6 +87,8 @@ static std::vector message_containing_done{ "12FF 8007" }; +static wxImage fail_image; + /* size */ #define PAGE_TITLE_HEIGHT FromDIP(36) @@ -103,12 +109,34 @@ static std::vector message_containing_done{ #define TASK_BUTTON_SIZE2 (wxSize(-1, FromDIP(24))) #define Z_BUTTON_SIZE (wxSize(FromDIP(52), FromDIP(52))) #define MISC_BUTTON_PANEL_SIZE (wxSize(FromDIP(136), FromDIP(55))) -#define MISC_BUTTON_SIZE (wxSize(FromDIP(66), FromDIP(51))) +#define MISC_BUTTON_2FAN_SIZE (wxSize(FromDIP(66), FromDIP(51))) #define MISC_BUTTON_3FAN_SIZE (wxSize(FromDIP(44), FromDIP(51))) #define TEMP_CTRL_MIN_SIZE (wxSize(FromDIP(122), FromDIP(52))) #define AXIS_MIN_SIZE (wxSize(FromDIP(220), FromDIP(220))) #define EXTRUDER_IMAGE_SIZE (wxSize(FromDIP(48), FromDIP(76))) +static void market_model_scoring_page(int design_id) +{ + std::string url; + std::string country_code = GUI::wxGetApp().app_config->get_country_code(); + std::string model_http_url = GUI::wxGetApp().get_model_http_url(country_code); + if (GUI::wxGetApp().getAgent()->get_model_mall_detail_url(&url, std::to_string(design_id)) == 0) { + std::string user_id = GUI::wxGetApp().getAgent()->get_user_id(); + boost::algorithm::replace_first(url, "models", "u/" + user_id + "/rating"); + // Prevent user_id from containing design_id + size_t sign_in = url.find("/rating"); + std::string sub_url = url.substr(0, sign_in + 7); + url.erase(0, sign_in + 7); + boost::algorithm::replace_first(url, std::to_string(design_id), ""); + url = sub_url + url; + try { + if (!url.empty()) { wxLaunchDefaultBrowser(url); } + } catch (...) { + return; + } + } +} + PrintingTaskPanel::PrintingTaskPanel(wxWindow* parent, PrintingTaskType type) : wxPanel(parent, wxID_ANY,wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) { @@ -121,7 +149,6 @@ PrintingTaskPanel::~PrintingTaskPanel() { } - void PrintingTaskPanel::create_panel(wxWindow* parent) { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); @@ -357,28 +384,10 @@ void PrintingTaskPanel::create_panel(wxWindow* parent) penel_bottons->SetSizer(bSizer_buttons); penel_bottons->Layout(); - StateColor btn_bg_green(std::pair(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled), std::pair(wxColour(0, 137, 123), StateColor::Pressed), - std::pair(wxColour(38, 166, 154), StateColor::Hovered), std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal)); - StateColor btn_bd_green(std::pair(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Enabled)); - - m_button_market_scoring = new Button(parent, _L("Immediately score")); - m_button_market_scoring->SetBackgroundColor(btn_bg_green); - m_button_market_scoring->SetBorderColor(btn_bd_green); - m_button_market_scoring->SetTextColor(wxColour("#FFFFFE")); - m_button_market_scoring->SetSize(wxSize(FromDIP(128), FromDIP(26))); - m_button_market_scoring->SetMinSize(wxSize(-1, FromDIP(26))); - m_button_market_scoring->SetCornerRadius(FromDIP(13)); - - wxBoxSizer *bSizer_market_scoring = new wxBoxSizer(wxHORIZONTAL); - bSizer_market_scoring->Add(m_button_market_scoring); - bSizer_market_scoring->Add(0, 0, 1, wxEXPAND, 0); - m_button_market_scoring->Hide(); - bSizer_subtask_info->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(14)); bSizer_subtask_info->Add(bSizer_task_name, 0, wxEXPAND|wxRIGHT, FromDIP(18)); bSizer_subtask_info->Add(m_staticText_profile_value, 0, wxEXPAND | wxTOP, FromDIP(5)); bSizer_subtask_info->Add(m_printing_stage_value, 0, wxEXPAND | wxTOP, FromDIP(5)); - bSizer_subtask_info->Add(bSizer_market_scoring, 0, wxEXPAND | wxTOP, FromDIP(5)); bSizer_subtask_info->Add(penel_bottons, 0, wxEXPAND | wxTOP, FromDIP(10)); bSizer_subtask_info->Add(m_panel_progress, 0, wxEXPAND|wxRIGHT, FromDIP(25)); @@ -432,6 +441,76 @@ void PrintingTaskPanel::create_panel(wxWindow* parent) sizer->Add(m_panel_error_txt, 0, wxEXPAND | wxALL, 0); sizer->Add(0, FromDIP(12), 0); + m_score_staticline = new wxPanel(parent, wxID_ANY); + m_score_staticline->SetBackgroundColour(wxColour(238, 238, 238)); + m_score_staticline->Layout(); + m_score_staticline->Hide(); + sizer->Add(0, 0, 0, wxTOP, FromDIP(15)); + sizer->Add(m_score_staticline, 0, wxEXPAND | wxALL, FromDIP(10)); + + m_score_subtask_info = new wxPanel(parent, wxID_ANY); + m_score_subtask_info->SetBackgroundColour(*wxWHITE); + + wxBoxSizer * static_score_sizer = new wxBoxSizer(wxVERTICAL); + wxStaticText *static_score_text = new wxStaticText(m_score_subtask_info, wxID_ANY, _L("How do you like this printing file?"), wxDefaultPosition, wxDefaultSize, 0); + static_score_text->Wrap(-1); + static_score_sizer->Add(static_score_text, 1, wxEXPAND | wxALL, FromDIP(10)); + m_has_rated_prompt = new wxStaticText(m_score_subtask_info, wxID_ANY, _L("(The model has already been rated. Your rating will overwrite the previous rating.)"), wxDefaultPosition, wxDefaultSize, 0); + m_has_rated_prompt->Wrap(-1); + m_has_rated_prompt->SetForegroundColour(*wxRED); + m_has_rated_prompt->SetFont(::Label::Body_10); + m_has_rated_prompt->Hide(); + + m_star_count = 0; + wxBoxSizer *static_score_star_sizer = new wxBoxSizer(wxHORIZONTAL); + m_score_star.resize(5); + for (int i = 0; i < m_score_star.size(); ++i) { + m_score_star[i] = new ScalableButton(m_score_subtask_info, wxID_ANY, "score_star_dark", wxEmptyString, wxSize(FromDIP(26), FromDIP(26)), wxDefaultPosition, + wxBU_EXACTFIT | wxNO_BORDER, true, 26); + m_score_star[i]->Bind(wxEVT_LEFT_DOWN, [this, i](auto &e) { + for (int j = 0; j < m_score_star.size(); ++j) { + ScalableBitmap light_star = ScalableBitmap(nullptr, "score_star_light", 26); + m_score_star[j]->SetBitmap(light_star.bmp()); + if (m_score_star[j] == m_score_star[i]) { + m_star_count = j + 1; + break; + } + } + for (int k = m_star_count; k < m_score_star.size(); ++k) { + ScalableBitmap dark_star = ScalableBitmap(nullptr, "score_star_dark", 26); + m_score_star[k]->SetBitmap(dark_star.bmp()); + } + m_star_count_dirty = true; + m_button_market_scoring->Enable(true); + }); + static_score_star_sizer->Add(m_score_star[i], 0, wxEXPAND | wxLEFT, FromDIP(10)); + } + + StateColor btn_bg_green(std::pair(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled), std::pair(wxColour(27, 136, 68), StateColor::Pressed), + std::pair(wxColour(61, 203, 115), StateColor::Hovered), std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal)); + StateColor btn_bd_green(std::pair(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Enabled)); + + m_button_market_scoring = new Button(m_score_subtask_info, _L("Rate")); + m_button_market_scoring->SetBackgroundColor(btn_bg_green); + m_button_market_scoring->SetBorderColor(btn_bd_green); + m_button_market_scoring->SetTextColor(wxColour("#FFFFFE")); + m_button_market_scoring->SetSize(wxSize(FromDIP(128), FromDIP(26))); + m_button_market_scoring->SetMinSize(wxSize(-1, FromDIP(26))); + m_button_market_scoring->SetCornerRadius(FromDIP(13)); + m_button_market_scoring->Enable(false); + + static_score_star_sizer->Add(0, 0, 1, wxEXPAND, 0); + static_score_star_sizer->Add(m_button_market_scoring, 0, wxEXPAND | wxRIGHT, FromDIP(10)); + static_score_sizer->Add(static_score_star_sizer, 0, wxEXPAND, FromDIP(10)); + static_score_sizer->Add(m_has_rated_prompt, 1, wxEXPAND | wxALL, FromDIP(10)); + + m_score_subtask_info->SetSizer(static_score_sizer); + m_score_subtask_info->Layout(); + m_score_subtask_info->Hide(); + + sizer->Add(m_score_subtask_info, 0, wxEXPAND | wxALL, 0); + sizer->Add(0, FromDIP(12), 0); + if (m_type == CALIBRATION) { m_panel_printing_title->Hide(); m_bitmap_thumbnail->Hide(); @@ -444,6 +523,17 @@ void PrintingTaskPanel::create_panel(wxWindow* parent) parent->Fit(); } +void PrintingTaskPanel::set_has_reted_text(bool has_rated) +{ + if (has_rated) { + m_has_rated_prompt->Show(); + } else { + m_has_rated_prompt->Hide(); + } + Layout(); + Fit(); +} + void PrintingTaskPanel::msw_rescale() { m_panel_printing_title->SetSize(wxSize(-1, FromDIP(PAGE_TITLE_HEIGHT))); @@ -637,6 +727,33 @@ void PrintingTaskPanel::show_profile_info(bool show, wxString profile /*= wxEmpt } } +void PrintingTaskPanel::market_scoring_show() +{ + m_score_staticline->Show(); + m_score_subtask_info->Show(); +} + +void PrintingTaskPanel::market_scoring_hide() +{ + m_score_staticline->Hide(); + m_score_subtask_info->Hide(); +} + +void PrintingTaskPanel::set_star_count(int star_count) +{ + m_star_count = star_count; + + for (int i = 0; i < m_score_star.size(); ++i) { + if (i < star_count) { + ScalableBitmap light_star = ScalableBitmap(nullptr, "score_star_light", 26); + m_score_star[i]->SetBitmap(light_star.bmp()); + } else { + ScalableBitmap dark_star = ScalableBitmap(nullptr, "score_star_dark", 26); + m_score_star[i]->SetBitmap(dark_star.bmp()); + } + } +} + StatusBasePanel::StatusBasePanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name) : wxScrolledWindow(parent, id, pos, size, wxHSCROLL | wxVSCROLL) { @@ -783,6 +900,17 @@ wxBoxSizer *StatusBasePanel::create_monitoring_page() m_bmToggleBtn_timelapse->Hide(); bSizer_monitoring_title->Add(m_bmToggleBtn_timelapse, 0, wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(5)); +#if !BBL_RELEASE_TO_PUBLIC + m_staticText_timelapse->Show(); + m_bmToggleBtn_timelapse->Show(); + m_bmToggleBtn_timelapse->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &e) { + if (e.IsChecked()) + wxGetApp().getAgent()->start_subscribe("tunnel"); + else + wxGetApp().getAgent()->stop_subscribe("tunnel"); + }); +#endif + //m_bitmap_camera_img = new wxStaticBitmap(m_panel_monitoring_title, wxID_ANY, m_bitmap_camera , wxDefaultPosition, wxSize(FromDIP(32), FromDIP(18)), 0); //m_bitmap_camera_img->SetMinSize(wxSize(FromDIP(32), FromDIP(18))); //bSizer_monitoring_title->Add(m_bitmap_camera_img, 0, wxALIGN_CENTER_VERTICAL | wxALL, FromDIP(5)); @@ -984,15 +1112,17 @@ wxBoxSizer *StatusBasePanel::create_temp_control(wxWindow *parent) sizer->Add(line, 0, wxEXPAND | wxLEFT | wxRIGHT, 12); wxWindowID frame_id = wxWindow::NewControlId(); - m_tempCtrl_frame = new TempInput(parent, frame_id, TEMP_BLANK_STR, TEMP_BLANK_STR, wxString("monitor_frame_temp"), wxString("monitor_frame_temp"), wxDefaultPosition, + m_tempCtrl_chamber = new TempInput(parent, frame_id, TEMP_BLANK_STR, TEMP_BLANK_STR, wxString("monitor_frame_temp"), wxString("monitor_frame_temp"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER); - m_tempCtrl_frame->SetReadOnly(true); - m_tempCtrl_frame->SetMinSize(TEMP_CTRL_MIN_SIZE); - m_tempCtrl_frame->SetBorderWidth(FromDIP(2)); - m_tempCtrl_frame->SetTextColor(tempinput_text_colour); - m_tempCtrl_frame->SetBorderColor(tempinput_border_colour); + m_tempCtrl_chamber->SetReadOnly(true); + m_tempCtrl_chamber->SetMinTemp(nozzle_chamber_range[0]); + m_tempCtrl_chamber->SetMaxTemp(nozzle_chamber_range[1]); + m_tempCtrl_chamber->SetMinSize(TEMP_CTRL_MIN_SIZE); + m_tempCtrl_chamber->SetBorderWidth(FromDIP(2)); + m_tempCtrl_chamber->SetTextColor(tempinput_text_colour); + m_tempCtrl_chamber->SetBorderColor(tempinput_border_colour); - sizer->Add(m_tempCtrl_frame, 0, wxEXPAND | wxALL, 1); + sizer->Add(m_tempCtrl_chamber, 0, wxEXPAND | wxALL, 1); line = new StaticLine(parent); line->SetLineColour(STATIC_BOX_LINE_COL); sizer->Add(line, 0, wxEXPAND | wxLEFT | wxRIGHT, 12); @@ -1012,8 +1142,8 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent) /* create speed control */ m_switch_speed = new ImageSwitchButton(parent, m_bitmap_speed_active, m_bitmap_speed); m_switch_speed->SetLabels(_L("100%"), _L("100%")); - m_switch_speed->SetMinSize(MISC_BUTTON_SIZE); - m_switch_speed->SetMaxSize(MISC_BUTTON_SIZE); + m_switch_speed->SetMinSize(MISC_BUTTON_2FAN_SIZE); + m_switch_speed->SetMaxSize(MISC_BUTTON_2FAN_SIZE); m_switch_speed->SetPadding(FromDIP(3)); m_switch_speed->SetBorderWidth(FromDIP(2)); m_switch_speed->SetFont(Label::Head_13); @@ -1029,8 +1159,8 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent) /* create lamp control */ m_switch_lamp = new ImageSwitchButton(parent, m_bitmap_lamp_on, m_bitmap_lamp_off); m_switch_lamp->SetLabels(_L("Lamp"), _L("Lamp")); - m_switch_lamp->SetMinSize(MISC_BUTTON_SIZE); - m_switch_lamp->SetMaxSize(MISC_BUTTON_SIZE); + m_switch_lamp->SetMinSize(MISC_BUTTON_2FAN_SIZE); + m_switch_lamp->SetMaxSize(MISC_BUTTON_2FAN_SIZE); m_switch_lamp->SetPadding(FromDIP(3)); m_switch_lamp->SetBorderWidth(FromDIP(2)); m_switch_lamp->SetFont(Label::Head_13); @@ -1109,10 +1239,14 @@ wxBoxSizer *StatusBasePanel::create_misc_control(wxWindow *parent) m_fan_panel->SetBackgroundColor(parent->GetBackgroundColour()); }); + m_switch_block_fan = new wxPanel(m_fan_panel); + m_switch_block_fan->SetBackgroundColour(parent->GetBackgroundColour()); + fan_line_sizer->Add(0, 0, 0, wxLEFT, FromDIP(2)); fan_line_sizer->Add(m_switch_nozzle_fan, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM , FromDIP(2)); fan_line_sizer->Add(m_switch_printing_fan, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, FromDIP(2)); fan_line_sizer->Add(m_switch_cham_fan, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM , FromDIP(2)); + fan_line_sizer->Add(m_switch_block_fan, 1, wxEXPAND | wxTOP | wxBOTTOM , FromDIP(2)); fan_line_sizer->Add(0, 0, 0, wxLEFT, FromDIP(2)); m_fan_panel->SetSizer(fan_line_sizer); @@ -1131,12 +1265,12 @@ void StatusBasePanel::reset_temp_misc_control() m_tempCtrl_nozzle->GetTextCtrl()->SetValue(TEMP_BLANK_STR); m_tempCtrl_bed->SetLabel(TEMP_BLANK_STR); m_tempCtrl_bed->GetTextCtrl()->SetValue(TEMP_BLANK_STR); - m_tempCtrl_frame->SetLabel(TEMP_BLANK_STR); - m_tempCtrl_frame->GetTextCtrl()->SetValue(TEMP_BLANK_STR); + m_tempCtrl_chamber->SetLabel(TEMP_BLANK_STR); + m_tempCtrl_chamber->GetTextCtrl()->SetValue(TEMP_BLANK_STR); m_button_unload->Show(); m_tempCtrl_nozzle->Enable(true); - m_tempCtrl_frame->Enable(true); + m_tempCtrl_chamber->Enable(true); m_tempCtrl_bed->Enable(true); // reset misc control @@ -1351,11 +1485,11 @@ wxBoxSizer *StatusBasePanel::create_ams_group(wxWindow *parent) return sizer; } -void StatusBasePanel::show_ams_group(bool show, bool support_virtual_tray, bool support_extrustion_cali) +void StatusBasePanel::show_ams_group(bool show) { m_ams_control->Show(true); m_ams_control_box->Show(true); - m_ams_control->show_noams_mode(show, support_virtual_tray, support_extrustion_cali); + m_ams_control->show_noams_mode(); if (m_show_ams_group != show) { Fit(); } @@ -1459,6 +1593,8 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co m_buttons.push_back(m_bpButton_e_down_10); obj = nullptr; + m_score_data = new ScoreData; + m_score_data->rating_id = -1; /* set default values */ m_switch_lamp->SetValue(false); m_switch_printing_fan->SetValue(false); @@ -1478,6 +1614,8 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co on_set_bed_temp(); } else if (id == m_tempCtrl_nozzle->GetType()) { on_set_nozzle_temp(); + } else if (id == m_tempCtrl_chamber->GetType()) { + on_set_chamber_temp(); } }); @@ -1495,10 +1633,12 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co m_tempCtrl_bed->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_bed_temp_set_focus), NULL, this); m_tempCtrl_nozzle->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_kill_focus), NULL, this); m_tempCtrl_nozzle->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_nozzle_temp_set_focus), NULL, this); + m_tempCtrl_chamber->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(StatusPanel::on_cham_temp_kill_focus), NULL, this); + m_tempCtrl_chamber->Connect(wxEVT_SET_FOCUS, wxFocusEventHandler(StatusPanel::on_cham_temp_set_focus), NULL, this); m_switch_lamp->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_lamp_switch), NULL, this); m_switch_nozzle_fan->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_nozzle_fan_switch), NULL, this); // TODO m_switch_printing_fan->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_nozzle_fan_switch), NULL, this); - m_switch_cham_fan->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_nozzle_fan_switch), NULL, this); + m_switch_cham_fan->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_nozzle_fan_switch), NULL, this); m_bpButton_xy->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_xy), NULL, this); // TODO m_bpButton_z_10->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_z_up_10), NULL, this); m_bpButton_z_1->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_axis_ctrl_z_up_1), NULL, this); @@ -1569,6 +1709,10 @@ StatusPanel::~StatusPanel() if (sdcard_hint_dlg != nullptr) delete sdcard_hint_dlg; + + if (m_score_data != nullptr) { + delete m_score_data; + } } void StatusPanel::init_scaled_buttons() @@ -1591,8 +1735,65 @@ void StatusPanel::init_scaled_buttons() } void StatusPanel::on_market_scoring(wxCommandEvent &event) { - if (obj && obj->get_modeltask() && obj->get_modeltask()->design_id > 0) { - market_model_scoring_page(obj->get_modeltask()->design_id); + if (obj && obj->get_modeltask() && obj->get_modeltask()->design_id > 0 && m_rating_result.contains("id")) { // model is mall model and has rating_id + + if (m_score_data && m_score_data->rating_id == m_rating_result["id"].get()) { // current score data for model is same as mall model + ScoreDialog m_score_dlg(this, m_score_data); + int ret = m_score_dlg.ShowModal(); + + if (ret == wxID_OK) { + m_score_data->rating_id = -1; + m_project_task_panel->set_star_count_dirty(false); + m_print_finish = false; + return; + } + if (m_score_data != nullptr) { + delete m_score_data; + m_score_data = nullptr; + } + m_score_data = new ScoreData(m_score_dlg.get_score_data()); // when user do not submit score, store the data for next opening the score dialog + m_project_task_panel->set_star_count(m_score_data->star_count); + } else { + //to do: if user has rated the model, show the comment on the dialog + int star_count = 0; + if (m_rating_result.contains("content")) + star_count = m_project_task_panel->get_star_count_dirty() ? m_project_task_panel->get_star_count() : m_rating_result["score"].get(); + bool success_print = true; + if (m_rating_result.contains("successPrinted")) + success_print = m_rating_result["successPrinted"].get(); + ScoreDialog m_score_dlg(this, obj->get_modeltask()->design_id, obj->get_modeltask()->model_id, obj->get_modeltask()->profile_id, + m_rating_result["id"].get(), success_print, star_count); + + if (m_rating_result.contains("content")) { + std::string comment = m_rating_result["content"].get(); + if (!comment.empty()) { + m_score_dlg.set_comment(comment); + } + } + + if (m_rating_result.contains("images")) { + std::vector images_json_array; + images_json_array = m_rating_result["images"].get>(); + m_score_dlg.set_cloud_bitmap(images_json_array); + } + + int ret = m_score_dlg.ShowModal(); + + if (ret == wxID_OK) { + m_score_data->rating_id = -1; + m_project_task_panel->set_star_count_dirty(false); + m_print_finish = false; + return; + } + if (m_score_data != nullptr) { + delete m_score_data; + m_score_data = nullptr; + } + m_score_data = new ScoreData(m_score_dlg.get_score_data()); + m_project_task_panel->set_star_count(m_score_data->star_count); + } + + } } @@ -1696,6 +1897,7 @@ bool StatusPanel::is_task_changed(MachineObject* obj) last_subtask = obj->subtask_; last_profile_id = obj->profile_id_; last_task_id = obj->task_id_; + request_model_info_flag = false; return true; } return false; @@ -1709,6 +1911,14 @@ void StatusPanel::update(MachineObject *obj) update_subtask(obj); m_project_task_panel->Thaw(); +#if !BBL_RELEASE_TO_PUBLIC + m_staticText_timelapse + ->SetLabel(obj->is_lan_mode_printer() ? "Local Mqtt" : obj->is_tunnel_mqtt ? "Tunnel Mqtt" : "Cloud Mqtt"); + m_bmToggleBtn_timelapse + ->Enable(!obj->is_lan_mode_printer()); + m_bmToggleBtn_timelapse + ->SetValue(obj->is_tunnel_mqtt); +#endif m_machine_ctrl_panel->Freeze(); @@ -1725,11 +1935,9 @@ void StatusPanel::update(MachineObject *obj) if (obj) { // update extrusion calibration - if (obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)) { - if (m_extrusion_cali_dlg) { - m_extrusion_cali_dlg->update_machine_obj(obj); - m_extrusion_cali_dlg->update(); - } + if (m_extrusion_cali_dlg) { + m_extrusion_cali_dlg->update_machine_obj(obj); + m_extrusion_cali_dlg->update(); } // update calibration status @@ -1747,23 +1955,30 @@ void StatusPanel::update(MachineObject *obj) || obj->is_function_supported(PrinterFunction::FUNC_BUILDPLATE_MARKER_DETECT) || obj->is_function_supported(PrinterFunction::FUNC_AUTO_RECOVERY_STEP_LOSS)) { m_options_btn->Show(); - if (print_options_dlg == nullptr) { - print_options_dlg = new PrintOptionsDialog(this); - print_options_dlg->update_machine_obj(obj); - } else { + if (print_options_dlg) { print_options_dlg->update_machine_obj(obj); + print_options_dlg->update_options(obj); } - print_options_dlg->update_options(obj); } else { m_options_btn->Hide(); } + //support edit chamber temp if (obj->is_function_supported(PrinterFunction::FUNC_CHAMBER_TEMP)) { - m_tempCtrl_frame->Enable(); + m_tempCtrl_chamber->SetReadOnly(false); + m_tempCtrl_chamber->Enable(); } else { - m_tempCtrl_frame->SetLabel(TEMP_BLANK_STR); - m_tempCtrl_frame->GetTextCtrl()->SetValue(TEMP_BLANK_STR); - m_tempCtrl_frame->Disable(); + m_tempCtrl_chamber->SetReadOnly(true); + + if (obj->get_printer_series() == PrinterSeries::SERIES_X1) { + m_tempCtrl_chamber->SetTagTemp(TEMP_BLANK_STR); + }if (obj->get_printer_series() == PrinterSeries::SERIES_P1P) + { + m_tempCtrl_chamber->SetLabel(TEMP_BLANK_STR); + m_tempCtrl_chamber->GetTextCtrl()->SetValue(TEMP_BLANK_STR); + } + + m_tempCtrl_chamber->Disable(); } if (!obj->dev_connection_type.empty()) { @@ -1771,33 +1986,11 @@ void StatusPanel::update(MachineObject *obj) if (iter_connect_type != m_print_connect_types.end()) { if (iter_connect_type->second != obj->dev_connection_type) { - //lan = > cloud if (iter_connect_type->second == "lan" && obj->dev_connection_type == "cloud") { - /*wxString txt = _L("Disconnected from printer [%s] due to LAN mode disabled.Please reconnect the printer by logging in with your user account."); - wxString msg = wxString::Format(txt, obj->dev_name); - if (!m_show_mode_changed) { - m_show_mode_changed = true; - MessageDialog msg_wingow(nullptr, msg, wxEmptyString, wxICON_WARNING | wxOK); - msg_wingow.SetSize(wxSize(FromDIP(600), FromDIP(200))); - if (msg_wingow.ShowModal() == wxID_OK || msg_wingow.ShowModal() == wxID_CLOSE) { - m_show_mode_changed = false; - } - }*/ m_print_connect_types[obj->dev_id] = obj->dev_connection_type; } - //cloud = > lan if (iter_connect_type->second == "cloud" && obj->dev_connection_type == "lan") { - /*wxString txt = _L("Disconnected from printer [%s] due to LAN mode enabled.Please reconnect the printer by inputting Access Code which can be gotten from printer screen."); - wxString msg = wxString::Format(txt, obj->dev_name); - if (!m_show_mode_changed) { - m_show_mode_changed = true; - MessageDialog msg_wingow(nullptr, msg, wxEmptyString, wxICON_WARNING | wxOK); - msg_wingow.SetSize(wxSize(FromDIP(600), FromDIP(200))); - if (msg_wingow.ShowModal() == wxID_OK || msg_wingow.ShowModal() == wxID_CLOSE) { - m_show_mode_changed = false; - } - }*/ m_print_connect_types[obj->dev_id] = obj->dev_connection_type; } } @@ -1819,28 +2012,6 @@ void StatusPanel::show_recenter_dialog() { obj->command_go_home(); } -void StatusPanel::market_model_scoring_page(int design_id) -{ - std::string url; - std::string country_code = GUI::wxGetApp().app_config->get_country_code(); - std::string model_http_url = GUI::wxGetApp().get_model_http_url(country_code); - if (GUI::wxGetApp().getAgent()->get_model_mall_detail_url(&url, std::to_string(design_id)) == 0) { - std::string user_id = GUI::wxGetApp().getAgent()->get_user_id(); - boost::algorithm::replace_first(url, "models", "u/" + user_id + "/rating"); - // Prevent user_id from containing design_id - size_t sign_in = url.find("/rating"); - std::string sub_url = url.substr(0, sign_in + 7); - url.erase(0, sign_in + 7); - boost::algorithm::replace_first(url, std::to_string(design_id), ""); - url = sub_url + url; - try { - if (!url.empty()) { wxLaunchDefaultBrowser(url); } - } catch (...) { - return; - } - } -} - void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::string print_error_str) { if (msg.IsEmpty()) { @@ -1865,13 +2036,11 @@ void StatusPanel::show_error_message(MachineObject* obj, wxString msg, std::stri m_print_error_dlg->update_title_style(_L("Warning"), SecondaryCheckDialog::ButtonStyle::ONLY_CONFIRM, this); } m_print_error_dlg->update_text(msg); - m_print_error_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, obj](wxCommandEvent& e) { if (obj) { obj->command_clean_print_error(obj->subtask_id_, obj->print_error); } }); - m_print_error_dlg->Bind(EVT_SECONDARY_CHECK_RETRY, [this, obj](wxCommandEvent& e) { if (m_ams_control) { @@ -1967,7 +2136,7 @@ void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area) if (!temp_area) { m_tempCtrl_nozzle->Enable(false); m_tempCtrl_bed->Enable(false); - m_tempCtrl_frame->Enable(false); + m_tempCtrl_chamber->Enable(false); m_switch_speed->Enable(false); m_switch_speed->SetValue(false); m_switch_lamp->Enable(false); @@ -1977,7 +2146,7 @@ void StatusPanel::show_printing_status(bool ctrl_area, bool temp_area) } else { m_tempCtrl_nozzle->Enable(); m_tempCtrl_bed->Enable(); - m_tempCtrl_frame->Enable(); + m_tempCtrl_chamber->Enable(); m_switch_speed->Enable(); m_switch_speed->SetValue(true); m_switch_lamp->Enable(); @@ -2008,6 +2177,13 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj) } m_tempCtrl_nozzle->SetCurrTemp((int) obj->nozzle_temp); + int nozzle_max_temp = 0; + if (DeviceManager::get_nozzle_max_temperature(obj->printer_type, nozzle_max_temp)) { + if (m_tempCtrl_nozzle) m_tempCtrl_nozzle->SetMaxTemp(nozzle_max_temp); + } + else { + if (m_tempCtrl_nozzle) m_tempCtrl_nozzle->SetMaxTemp(nozzle_temp_range[1]); + } if (m_temp_nozzle_timeout > 0) { m_temp_nozzle_timeout--; @@ -2021,8 +2197,21 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj) m_tempCtrl_nozzle->SetIconNormal(); } - m_tempCtrl_frame->SetCurrTemp(obj->chamber_temp); - m_tempCtrl_frame->SetTagTemp(obj->chamber_temp); + m_tempCtrl_chamber->SetCurrTemp(obj->chamber_temp); + // update temprature if not input temp target + if (m_temp_chamber_timeout > 0) { + m_temp_chamber_timeout--; + } + else { + if (!cham_temp_input) { m_tempCtrl_chamber->SetTagTemp(obj->chamber_temp_target); } + } + + if ((obj->chamber_temp_target - obj->chamber_temp) >= TEMP_THRESHOLD_VAL) { + m_tempCtrl_chamber->SetIconActive(); + } + else { + m_tempCtrl_chamber->SetIconNormal(); + } } void StatusPanel::update_misc_ctrl(MachineObject *obj) @@ -2041,10 +2230,18 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj) } } + if (obj->is_core_xy()) { + m_staticText_z_tip->SetLabel(_L("Bed")); + } else { + m_staticText_z_tip->SetLabel("Z"); + } + // update extruder icon update_extruder_status(obj); + bool is_suppt_aux_fun = obj->is_function_supported(PrinterFunction::FUNC_AUX_FAN); bool is_suppt_cham_fun = obj->is_function_supported(PrinterFunction::FUNC_CHAMBER_FAN); + //update cham fan if (m_current_support_cham_fan != is_suppt_cham_fun) { if (is_suppt_cham_fun) { @@ -2056,15 +2253,35 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj) } else { m_switch_cham_fan->Hide(); - m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_SIZE); - m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_SIZE); - m_switch_printing_fan->SetMinSize(MISC_BUTTON_SIZE); - m_switch_printing_fan->SetMaxSize(MISC_BUTTON_SIZE); + m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_2FAN_SIZE); + m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_2FAN_SIZE); + m_switch_printing_fan->SetMinSize(MISC_BUTTON_2FAN_SIZE); + m_switch_printing_fan->SetMaxSize(MISC_BUTTON_2FAN_SIZE); } m_misc_ctrl_sizer->Layout(); } + if (m_current_support_aux_fan != is_suppt_aux_fun) { + if (is_suppt_aux_fun) { + m_switch_printing_fan->Show(); + m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_3FAN_SIZE); + m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_3FAN_SIZE); + m_switch_cham_fan->SetMinSize(MISC_BUTTON_3FAN_SIZE); + m_switch_cham_fan->SetMaxSize(MISC_BUTTON_3FAN_SIZE); + } + else { + m_switch_printing_fan->Hide(); + m_switch_nozzle_fan->SetMinSize(MISC_BUTTON_2FAN_SIZE); + m_switch_nozzle_fan->SetMaxSize(MISC_BUTTON_2FAN_SIZE); + m_switch_cham_fan->SetMinSize(MISC_BUTTON_2FAN_SIZE); + m_switch_cham_fan->SetMaxSize(MISC_BUTTON_2FAN_SIZE); + } + + m_misc_ctrl_sizer->Layout(); + } + + // nozzle fan if (m_switch_nozzle_fan_timeout > 0) { m_switch_nozzle_fan_timeout--; @@ -2120,7 +2337,8 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj) m_switch_speed->SetLabels(text_speed, text_speed); } - m_current_support_cham_fan = is_suppt_cham_fun?true:false; + m_current_support_aux_fan = is_suppt_aux_fun; + m_current_support_cham_fan = is_suppt_cham_fun; } void StatusPanel::update_extruder_status(MachineObject* obj) @@ -2163,9 +2381,9 @@ void StatusPanel::update_ams(MachineObject *obj) CalibUtils::emit_get_PA_calib_info(obj->nozzle_diameter, ""); } - bool is_support_extrusion_cali = obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI); - bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY); + bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY); bool is_support_filament_backup = obj->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP); + AMSModel ams_mode = AMSModel::GENERIC_AMS; if (!obj || !obj->is_connected() @@ -2181,13 +2399,20 @@ void StatusPanel::update_ams(MachineObject *obj) BOOST_LOG_TRIVIAL(trace) << "machine object" << obj->dev_name << " was disconnected, set show_ams_group is false"; } - show_ams_group(false, obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY), is_support_extrusion_cali); + + if (obj->printer_type == "N1") { ams_mode = AMSModel::EXTRA_AMS; } + m_ams_control->SetAmsModel(AMSModel::NO_AMS, ams_mode); + + show_ams_group(false); m_ams_control->show_auto_refill(false); } else { - show_ams_group(true, obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY), is_support_extrusion_cali); + if (obj->printer_type == "N1") { ams_mode = AMSModel::EXTRA_AMS; } + m_ams_control->SetAmsModel(ams_mode, ams_mode); - if (!obj->m_is_support_show_bak || !is_support_filament_backup || !obj->ams_support_auto_switch_filament_flag) { + show_ams_group(true); + + if (!is_support_filament_backup || !obj->ams_support_auto_switch_filament_flag) { m_ams_control->show_auto_refill(false); } else { @@ -2219,7 +2444,7 @@ void StatusPanel::update_ams(MachineObject *obj) //} // must select a current can - m_ams_control->UpdateAms(ams_info, false, is_support_extrusion_cali); + m_ams_control->UpdateAms(ams_info, false); last_tray_exist_bits = obj->tray_exist_bits; last_ams_exist_bits = obj->ams_exist_bits; @@ -2253,13 +2478,15 @@ void StatusPanel::update_ams(MachineObject *obj) // set segment 3 if (obj->m_tray_now == std::to_string(VIRTUAL_TRAY_ID)) { - m_ams_control->SetExtruder(obj->is_filament_at_extruder(), true, obj->vt_tray.get_color()); + m_ams_control->SetExtruder(obj->is_filament_at_extruder(), true, obj->m_ams_id, obj->vt_tray.get_color()); } else { - m_ams_control->SetExtruder(obj->is_filament_at_extruder(), false, m_ams_control->GetCanColour(obj->m_ams_id, obj->m_tray_id)); + m_ams_control->SetExtruder(obj->is_filament_at_extruder(), false, obj->m_ams_id, m_ams_control->GetCanColour(obj->m_ams_id, obj->m_tray_id)); } if (obj->ams_status_main == AMS_STATUS_MAIN_FILAMENT_CHANGE) { + update_filament_step(); + if (obj->m_tray_tar == std::to_string(VIRTUAL_TRAY_ID) && (obj->m_tray_now != std::to_string(VIRTUAL_TRAY_ID) || obj->m_tray_now != "255")) { // wait to heat hotend if (obj->ams_status_sub == 0x02) { @@ -2330,6 +2557,14 @@ void StatusPanel::update_ams(MachineObject *obj) else { m_ams_control->SetFilamentStep(FilamentStep::STEP_PURGE_OLD_FILAMENT, FilamentStepType::STEP_TYPE_UNLOAD); } + } + else if (obj->ams_status_sub == 0x08) { + if (!obj->is_ams_unload()) { + m_ams_control->SetFilamentStep(FilamentStep::STEP_CHECK_POSITION, FilamentStepType::STEP_TYPE_LOAD); + } + else { + m_ams_control->SetFilamentStep(FilamentStep::STEP_CHECK_POSITION, FilamentStepType::STEP_TYPE_UNLOAD); + } } else { m_ams_control->SetFilamentStep(FilamentStep::STEP_IDLE, FilamentStepType::STEP_TYPE_UNLOAD); } @@ -2387,10 +2622,10 @@ void StatusPanel::update_ams(MachineObject *obj) is_curr_tray_selected = true; } - update_ams_control_state(is_support_extrusion_cali, is_curr_tray_selected); + update_ams_control_state(is_curr_tray_selected); } -void StatusPanel::update_ams_control_state(bool is_support_virtual_tray, bool is_curr_tray_selected) +void StatusPanel::update_ams_control_state(bool is_curr_tray_selected) { // set default value to true bool enable[ACTION_BTN_COUNT]; @@ -2398,21 +2633,18 @@ void StatusPanel::update_ams_control_state(bool is_support_virtual_tray, bool is enable[ACTION_BTN_LOAD] = true; enable[ACTION_BTN_UNLOAD] = true; - if (!is_support_virtual_tray) { - enable[ACTION_BTN_CALI] = false; - } - else { - if (obj->is_in_printing()) { - if (obj->is_in_extrusion_cali()) { - enable[ACTION_BTN_LOAD] = false; - enable[ACTION_BTN_UNLOAD] = false; - enable[ACTION_BTN_CALI] = true; - } else { - enable[ACTION_BTN_CALI] = false; - } - } else { + if (obj->is_in_printing()) { + if (obj->is_in_extrusion_cali()) { + enable[ACTION_BTN_LOAD] = false; + enable[ACTION_BTN_UNLOAD] = false; enable[ACTION_BTN_CALI] = true; } + else { + enable[ACTION_BTN_CALI] = false; + } + } + else { + enable[ACTION_BTN_CALI] = true; } if (obj->is_in_printing() && !obj->can_resume()) { @@ -2492,18 +2724,24 @@ void StatusPanel::update_basic_print_data(bool def) void StatusPanel::update_model_info() { + auto get_subtask_fn = [this](BBLModelTask* subtask) { + if (obj && obj->subtask_id_ == subtask->task_id) { + obj->set_modeltask(subtask); + } + }; + + if (wxGetApp().getAgent() && obj) { BBLSubTask* curr_task = obj->get_subtask(); if (curr_task) { BBLModelTask* curr_model_task = obj->get_modeltask(); - if (!curr_model_task) { + if (!curr_model_task && !request_model_info_flag) { curr_model_task = new BBLModelTask(); curr_model_task->task_id = curr_task->task_id; - int result = wxGetApp().getAgent()->get_subtask(curr_model_task); - - if (result > -1) { - obj->set_modeltask(curr_model_task); + request_model_info_flag = true; + if (!curr_model_task->task_id.empty() && curr_model_task->task_id.compare("0") != 0) { + wxGetApp().getAgent()->get_subtask(curr_model_task, get_subtask_fn); } } } @@ -2528,7 +2766,7 @@ void StatusPanel::update_subtask(MachineObject *obj) reset_printing_values(); } else if (obj->is_in_printing() || obj->print_status == "FINISH") { if (obj->is_in_prepare() || obj->print_status == "SLICING") { - m_project_task_panel->get_market_scoring_button()->Hide(); + m_project_task_panel->market_scoring_hide(); m_project_task_panel->enable_abort_button(false); m_project_task_panel->enable_pause_resume_button(false, "pause_disable"); wxString prepare_text; @@ -2577,33 +2815,61 @@ void StatusPanel::update_subtask(MachineObject *obj) m_project_task_panel->enable_abort_button(false); m_project_task_panel->enable_pause_resume_button(false, "resume_disable"); if (wxGetApp().has_model_mall()) { + //determine whether the model is mall model bool is_market_task = obj->get_modeltask() && obj->get_modeltask()->design_id > 0; if (is_market_task) { - m_project_task_panel->get_market_scoring_button()->Show(); - BOOST_LOG_TRIVIAL(info) << "SHOW_SCORE_BTU: design_id [" << obj->get_modeltask()->design_id << "] print_finish [" << m_print_finish << "]"; - if (!m_print_finish && IsShownOnScreen()) { - m_print_finish = true; - int job_id = obj->get_modeltask()->job_id; - if (wxGetApp().app_config->get("not_show_score_dialog") != "1" && rated_model_id.find(job_id) == rated_model_id.end()) { - MessageDialog dlg(this, _L("Please give a score for your favorite Bambu Market model."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Score"), - wxYES_NO | wxYES_DEFAULT | wxCENTRE); - dlg.show_dsa_button(); - int old_design_id = obj->get_modeltask()->design_id; - auto res = dlg.ShowModal(); - if (dlg.get_checkbox_state()) { wxGetApp().app_config->set("not_show_score_dialog", "1"); } - if (res == wxID_YES) { market_model_scoring_page(old_design_id); } - rated_model_id.insert(job_id); - BOOST_LOG_TRIVIAL(info) << "SHOW_SCORE_DLG: design_id [" << old_design_id << "] print_finish [" << m_print_finish << "] not_show [" - << wxGetApp().app_config->get("not_show_score_dialog") << "] job_id [" << job_id << "]"; - } + NetworkAgent *agent = wxGetApp().getAgent(); + if (agent && IsShownOnScreen() && !m_print_finish) { + + int job_id = obj->get_modeltask()->job_id; + boost::thread([this, agent, job_id] { + try { + std::string rating_result; + unsigned int http_code = 0; + std::string http_error; + int rating_id = -1; + int res = agent->get_model_mall_rating_result(job_id, rating_result, http_code, http_error); + if (0 == res) { + m_rating_result = json::parse(rating_result); + if (m_rating_result.contains("id")) { + rating_id = m_rating_result["id"].get(); + m_project_task_panel->market_scoring_show(); + BOOST_LOG_TRIVIAL(info) << "show scoring page"; + bool is_update = model_score_is_update(); + // this mall model has score, user do not click star, Initialize scores only once per print startup program + if (is_update || + (!m_project_task_panel->get_star_count_dirty() && !m_print_finish && IsShownOnScreen() && m_rating_result.contains("score"))) { + int star_count = m_rating_result["score"].get(); + m_project_task_panel->set_star_count(star_count); + BOOST_LOG_TRIVIAL(info) << "Initialize scores"; + m_project_task_panel->set_star_count_dirty(true); + m_print_finish = true; + if (0 != star_count) { + m_project_task_panel->get_market_scoring_button()->Enable(true); + m_project_task_panel->set_has_reted_text(true); + } else { + m_project_task_panel->set_has_reted_text(false); + } + } + } + } + } catch (...) { + m_project_task_panel->market_scoring_hide(); + BOOST_LOG_TRIVIAL(info) << "get mall model rating id failed and hide scoring page"; + } + }); } - } else { - m_project_task_panel->get_market_scoring_button()->Hide(); + BOOST_LOG_TRIVIAL(info) << "SHOW_SCORE_BTU: design_id [" << obj->get_modeltask()->design_id << "] print_finish [" << m_print_finish << "]"; + + } else { // model is not mall model. hide scoring page + m_project_task_panel->market_scoring_hide(); } + } else { // have no model mall, hide scoring page + m_project_task_panel->market_scoring_hide(); } - } else { + } else { // model printing is not finished, hide scoring page m_project_task_panel->enable_abort_button(true); - m_project_task_panel->get_market_scoring_button()->Hide(); + m_project_task_panel->market_scoring_hide(); if (m_print_finish) { m_print_finish = false; } @@ -2647,6 +2913,21 @@ void StatusPanel::update_subtask(MachineObject *obj) this->Layout(); } +bool StatusPanel::model_score_is_update() +{ + try { + if (m_last_result["id"] != m_rating_result["id"] || m_last_result["content"] != m_rating_result["content"] || m_last_result["images"] != m_rating_result["images"]) { + m_last_result = m_rating_result; + return true; + } + } catch (...) { + BOOST_LOG_TRIVIAL(info) << "m_last_result first initial"; + m_last_result = m_rating_result; + } + + return false; +} + void StatusPanel::update_cloud_subtask(MachineObject *obj) { if (!obj) return; @@ -2708,7 +2989,7 @@ void StatusPanel::reset_printing_values() m_project_task_panel->update_progress_percent(NA_STR, wxEmptyString); - m_project_task_panel->get_market_scoring_button()->Hide(); + m_project_task_panel->market_scoring_hide(); update_basic_print_data(false); m_project_task_panel->update_left_time(NA_STR); m_project_task_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR)); @@ -2887,53 +3168,64 @@ void StatusPanel::on_set_nozzle_temp() } } +void StatusPanel::on_set_chamber_temp() +{ + wxString str = m_tempCtrl_chamber->GetTextCtrl()->GetValue(); + try { + long chamber_temp; + if (str.ToLong(&chamber_temp) && obj) { + set_hold_count(m_temp_chamber_timeout); + obj->command_set_chamber(chamber_temp); + } + } + catch (...) { + ; + } +} + void StatusPanel::on_ams_load(SimpleEvent &event) { BOOST_LOG_TRIVIAL(info) << "on_ams_load"; on_ams_load_curr(); } +void StatusPanel::update_filament_step() +{ + m_ams_control->UpdateStepCtrl(obj->is_filament_at_extruder()); + if (!obj->is_filament_at_extruder()) { + m_is_load_with_temp = true; + } + else { + m_is_load_with_temp = false; + } +} + void StatusPanel::on_ams_load_curr() { if (obj) { std::string curr_ams_id = m_ams_control->GetCurentAms(); std::string curr_can_id = m_ams_control->GetCurrentCan(curr_ams_id); - m_ams_control->UpdateStepCtrl(obj->is_filament_at_extruder()); - if(!obj->is_filament_at_extruder()){ - m_is_load_with_temp = true; - }else{ - m_is_load_with_temp = false; - } - + update_filament_step(); //virtual tray if (curr_ams_id.compare(std::to_string(VIRTUAL_TRAY_ID)) == 0) { - /*if (con_load_dlg == nullptr) { - con_load_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Confirm")); - con_load_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent& e) {*/ - int old_temp = -1; - int new_temp = -1; - AmsTray* curr_tray = &obj->vt_tray; + int old_temp = -1; + int new_temp = -1; + AmsTray* curr_tray = &obj->vt_tray; - if (!curr_tray) return; + if (!curr_tray) return; - try { - if (!curr_tray->nozzle_temp_max.empty() && !curr_tray->nozzle_temp_min.empty()) - old_temp = (atoi(curr_tray->nozzle_temp_min.c_str()) + atoi(curr_tray->nozzle_temp_max.c_str())) / 2; - if (!obj->vt_tray.nozzle_temp_max.empty() && !obj->vt_tray.nozzle_temp_min.empty()) - new_temp = (atoi(obj->vt_tray.nozzle_temp_min.c_str()) + atoi(obj->vt_tray.nozzle_temp_max.c_str())) / 2; - } - catch (...) { - ; - } - obj->command_ams_switch(VIRTUAL_TRAY_ID, old_temp, new_temp); - /*} - ); + try { + if (!curr_tray->nozzle_temp_max.empty() && !curr_tray->nozzle_temp_min.empty()) + old_temp = (atoi(curr_tray->nozzle_temp_min.c_str()) + atoi(curr_tray->nozzle_temp_max.c_str())) / 2; + if (!obj->vt_tray.nozzle_temp_max.empty() && !obj->vt_tray.nozzle_temp_min.empty()) + new_temp = (atoi(obj->vt_tray.nozzle_temp_min.c_str()) + atoi(obj->vt_tray.nozzle_temp_max.c_str())) / 2; } - con_load_dlg->update_text(_L("Please confirm the filament is ready?")); - con_load_dlg->on_show();*/ - return; + catch (...) { + ; + } + obj->command_ams_switch(VIRTUAL_TRAY_ID, old_temp, new_temp); } std::map::iterator it = obj->amsList.find(curr_ams_id); @@ -2990,6 +3282,7 @@ void StatusPanel::on_ams_setting_click(SimpleEvent &event) if (obj) { m_ams_setting_dlg->update_insert_material_read_mode(obj->ams_insert_flag); m_ams_setting_dlg->update_starting_read_mode(obj->ams_power_on_flag); + m_ams_setting_dlg->update_image(obj->printer_type == "N1"?"generic":"f1"); std::string ams_id = m_ams_control->GetCurentShowAms(); if (obj->amsList.size() == 0) { /* wxString txt = _L("AMS settings are not supported for external spool"); @@ -3247,7 +3540,6 @@ void StatusPanel::on_ams_selected(wxCommandEvent &event) } catch (...) { ; } - //update_ams_control_state(curr_ams_id, obj->is_function_supported(PrinterFunction::FUNC_EXTRUSION_CALI)); } } } @@ -3299,6 +3591,18 @@ void StatusPanel::on_fan_changed(wxCommandEvent& event) } } +void StatusPanel::on_cham_temp_kill_focus(wxFocusEvent& event) +{ + event.Skip(); + cham_temp_input = false; +} + +void StatusPanel::on_cham_temp_set_focus(wxFocusEvent& event) +{ + event.Skip(); + cham_temp_input = true; +} + void StatusPanel::on_bed_temp_kill_focus(wxFocusEvent &event) { event.Skip(); @@ -3417,8 +3721,8 @@ void StatusPanel::on_nozzle_fan_switch(wxCommandEvent &event) m_fan_control_popup = new FanControlPopup(this); if (obj) { - bool is_suppt_cham_fun = obj->is_function_supported(PrinterFunction::FUNC_CHAMBER_FAN); - m_fan_control_popup->update_show_mode(is_suppt_cham_fun); + m_fan_control_popup->show_cham_fan(obj->is_function_supported(PrinterFunction::FUNC_CHAMBER_FAN)); + m_fan_control_popup->show_aux_fan(obj->is_function_supported(PrinterFunction::FUNC_AUX_FAN)); } auto pos = m_switch_nozzle_fan->GetScreenPosition(); @@ -3579,6 +3883,7 @@ void StatusPanel::set_default() m_switch_lamp_timeout = 0; m_temp_nozzle_timeout = 0; m_temp_bed_timeout = 0; + m_temp_chamber_timeout = 0; m_switch_nozzle_fan_timeout = 0; m_switch_printing_fan_timeout = 0; m_switch_cham_fan_timeout = 0; @@ -3589,7 +3894,7 @@ void StatusPanel::set_default() m_bitmap_recording_img->Hide(); m_bitmap_vcamera_img->Hide(); m_setting_button->Show(); - m_tempCtrl_frame->Show(); + m_tempCtrl_chamber->Show(); m_options_btn->Show(); reset_temp_misc_control(); @@ -3723,17 +4028,17 @@ void StatusPanel::msw_rescale() m_line_nozzle->SetSize(wxSize(-1, FromDIP(1))); m_tempCtrl_bed->SetMinSize(TEMP_CTRL_MIN_SIZE); m_tempCtrl_bed->Rescale(); - m_tempCtrl_frame->SetMinSize(TEMP_CTRL_MIN_SIZE); - m_tempCtrl_frame->Rescale(); + m_tempCtrl_chamber->SetMinSize(TEMP_CTRL_MIN_SIZE); + m_tempCtrl_chamber->Rescale(); m_bitmap_speed.msw_rescale(); m_bitmap_speed_active.msw_rescale(); m_switch_speed->SetImages(m_bitmap_speed, m_bitmap_speed); - m_switch_speed->SetMinSize(MISC_BUTTON_SIZE); + m_switch_speed->SetMinSize(MISC_BUTTON_2FAN_SIZE); m_switch_speed->Rescale(); m_switch_lamp->SetImages(m_bitmap_lamp_on, m_bitmap_lamp_off); - m_switch_lamp->SetMinSize(MISC_BUTTON_SIZE); + m_switch_lamp->SetMinSize(MISC_BUTTON_2FAN_SIZE); m_switch_lamp->Rescale(); m_switch_nozzle_fan->SetImages(m_bitmap_fan_on, m_bitmap_fan_off); m_switch_nozzle_fan->Rescale(); @@ -3759,4 +4064,658 @@ void StatusPanel::msw_rescale() Refresh(); } -}} // namespace Slic3r::GUI +ScoreDialog::ScoreDialog(wxWindow *parent, int design_id, std::string model_id, int profile_id, int rating_id, bool success_printed, int star_count) + : DPIDialog(parent, wxID_ANY, _L("Rate the Print Profile"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER) + , m_design_id(design_id) + , m_model_id(model_id) + , m_profile_id(profile_id) + , m_star_count(star_count) + , m_rating_id(rating_id) + , m_success_printed(success_printed) + , m_upload_status_code(StatusCode::CODE_NUMBER) +{ + m_tocken.reset(new int(0)); + + wxBoxSizer *m_main_sizer = get_main_sizer(); + + this->SetSizer(m_main_sizer); + Fit(); + Layout(); + wxGetApp().UpdateDlgDarkUI(this); +} + +ScoreDialog::ScoreDialog(wxWindow *parent, ScoreData *score_data) + : DPIDialog(parent, wxID_ANY, _L("Rate the Print Profile"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER) + , m_design_id(score_data->design_id) + , m_rating_id(score_data->rating_id) + , m_model_id(score_data->model_id) + , m_profile_id(score_data->profile_id) + , m_star_count(score_data->star_count) + , m_success_printed(score_data->success_printed) + , m_upload_status_code(StatusCode::CODE_NUMBER) +{ + m_tocken.reset(new int(0)); + + wxBoxSizer *m_main_sizer = get_main_sizer(score_data->local_to_url_image, score_data->comment_text); + + m_image_url_paths = score_data->image_url_paths; + + + this->SetSizer(m_main_sizer); + Fit(); + Layout(); + wxGetApp().UpdateDlgDarkUI(this); + +} + +ScoreDialog::~ScoreDialog() {} + +void ScoreDialog::on_dpi_changed(const wxRect &suggested_rect) {} + +void ScoreDialog::OnBitmapClicked(wxMouseEvent &event) +{ + wxStaticBitmap *clickedBitmap = dynamic_cast(event.GetEventObject()); + if (m_image.find(clickedBitmap) != m_image.end()) { + if (!m_image[clickedBitmap].is_selected) { + for (auto panel : m_image[clickedBitmap].image_broad) { + panel->Show(); + } + m_image[clickedBitmap].is_selected = true; + m_selected_image_list.insert(clickedBitmap); + } else { + for (auto panel : m_image[clickedBitmap].image_broad) { + panel->Hide(); + } + m_image[clickedBitmap].is_selected = false; + m_selected_image_list.erase(clickedBitmap); + m_selected_image_list.erase(clickedBitmap); + } + } + if (m_selected_image_list.empty()) + m_delete_photo->Hide(); + else + m_delete_photo->Show(); + Fit(); + Layout(); + +} + + std::set > ScoreDialog::add_need_upload_imgs() +{ + std::set> need_upload_images; + for (auto bitmap : m_image) { + if (!bitmap.second.is_uploaded) { + wxString &local_image_path = bitmap.second.local_image_url; + if (!local_image_path.empty()) { need_upload_images.insert(std::make_pair(bitmap.first, local_image_path)); } + } + } + return need_upload_images; +} + + + +std::pair ScoreDialog::create_local_thumbnail(wxString &local_path) +{ + std::pair bitmap_to_image_msg; + if (local_path.empty()) return bitmap_to_image_msg; + + ImageMsg cur_image_msg; + cur_image_msg.local_image_url = local_path; + cur_image_msg.img_url_paths = ""; + cur_image_msg.is_uploaded = false; + + wxStaticBitmap *imageCtrl = new wxStaticBitmap(this, wxID_ANY, wxBitmap(wxImage(local_path, wxBITMAP_TYPE_ANY).Rescale(FromDIP(80), FromDIP(60))), wxDefaultPosition, + wxDefaultSize, 0); + imageCtrl->Bind(wxEVT_LEFT_DOWN, &ScoreDialog::OnBitmapClicked, this); + + m_image_sizer->Add(create_broad_sizer(imageCtrl, cur_image_msg), 0, wxALL, 5); + + bitmap_to_image_msg.first = imageCtrl; + bitmap_to_image_msg.second = cur_image_msg; + + return bitmap_to_image_msg; +} + +std::pair ScoreDialog::create_oss_thumbnail(std::string &oss_path) +{ + std::pair bitmap_to_image_msg; + if (oss_path.empty()) return bitmap_to_image_msg; + + ImageMsg cur_image_msg; + cur_image_msg.local_image_url = ""; + cur_image_msg.img_url_paths = oss_path; + cur_image_msg.is_uploaded = true; + + + wxImage image(Slic3r::resources_dir() + "/images/oss_picture_loading.png", wxBITMAP_TYPE_ANY); + wxStaticBitmap *imageCtrl = new wxStaticBitmap(this, wxID_ANY, wxBitmap(image.Rescale(FromDIP(80), FromDIP(60))), wxDefaultPosition, wxDefaultSize, 0); + imageCtrl->Bind(wxEVT_LEFT_DOWN, &ScoreDialog::OnBitmapClicked, this); + + Slic3r::Http http = Slic3r::Http::get(oss_path); + std::string suffix = oss_path.substr(oss_path.find_last_of(".") + 1); + http.header("accept", "image/" + suffix) //"image/" + suffix + .header("Accept-Encoding", "gzip") + .on_complete([this, imageCtrl, time = std::weak_ptr(m_tocken)](std::string body, unsigned int status) { + if (time.expired()) return; + wxMemoryInputStream stream(body.data(), body.size()); + wxImage success_image; + if (success_image.LoadFile(stream, wxBITMAP_TYPE_ANY)) { + CallAfter([this, success_image, imageCtrl]() { update_static_bitmap(imageCtrl, success_image); }); + + } else { + CallAfter([this, imageCtrl]() { update_static_bitmap(imageCtrl, fail_image); }); + } + }) + .on_error([this, imageCtrl, &oss_path](std::string body, std::string error, unsigned status) { + BOOST_LOG_TRIVIAL(info) << "load oss picture failed, oss path: " << oss_path << " status:" << status << " error:" << error; + CallAfter([this, imageCtrl]() { update_static_bitmap(imageCtrl, fail_image); }); + }).perform(); + + m_image_sizer->Add(create_broad_sizer(imageCtrl, cur_image_msg), 0, wxALL, 5); + + bitmap_to_image_msg.first = imageCtrl; + bitmap_to_image_msg.second = cur_image_msg; + + return bitmap_to_image_msg; +} + +void ScoreDialog::update_static_bitmap(wxStaticBitmap* static_bitmap, wxImage image) +{ + static_bitmap->SetBitmap(wxBitmap(image.Rescale(FromDIP(80), FromDIP(60)))); + Layout(); + Fit(); + //Refresh(); +} + +wxBoxSizer *ScoreDialog::create_broad_sizer(wxStaticBitmap *bitmap, ImageMsg& cur_image_msg) +{ + // tb: top and bottom lr: left and right + auto m_image_tb_broad = new wxBoxSizer(wxVERTICAL); + auto line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); + line_top->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA)); + m_image_tb_broad->Add(line_top, 0, wxEXPAND, 0); + cur_image_msg.image_broad.push_back(line_top); + line_top->Hide(); + + auto m_image_lr_broad = new wxBoxSizer(wxHORIZONTAL); + auto line_left = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(1, -1), wxTAB_TRAVERSAL); + line_left->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA)); + m_image_lr_broad->Add(line_left, 0, wxEXPAND, 0); + cur_image_msg.image_broad.push_back(line_left); + line_left->Hide(); + + m_image_lr_broad->Add(bitmap, 0, wxALL, 5); + + auto line_right = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(1, -1), wxTAB_TRAVERSAL); + line_right->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA)); + m_image_lr_broad->Add(line_right, 0, wxEXPAND, 0); + m_image_tb_broad->Add(m_image_lr_broad, 0, wxEXPAND, 0); + cur_image_msg.image_broad.push_back(line_right); + line_right->Hide(); + + auto line_bottom = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); + line_bottom->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA)); + m_image_tb_broad->Add(line_bottom, 0, wxEXPAND, 0); + cur_image_msg.image_broad.push_back(line_bottom); + line_bottom->Hide(); + + cur_image_msg.is_selected = false; + cur_image_msg.image_tb_broad = m_image_tb_broad; + + return m_image_tb_broad; +} + +void ScoreDialog::init() { + SetBackgroundColour(*wxWHITE); + SetMinSize(wxSize(FromDIP(540), FromDIP(380))); + + fail_image = wxImage(Slic3r::resources_dir() + "/images/oss_picture_load_failed.png", wxBITMAP_TYPE_ANY); + // icon + std::string icon_path = (boost::format("%1%/images/BambuStudio.ico") % resources_dir()).str(); + SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO)); +} + +wxBoxSizer *ScoreDialog::get_score_sizer() { + wxBoxSizer *score_sizer = new wxBoxSizer(wxHORIZONTAL); + wxStaticText *static_score_text = new wxStaticText(this, wxID_ANY, _L("Rate"), wxDefaultPosition, wxDefaultSize, 0); + static_score_text->Wrap(-1); + score_sizer->Add(static_score_text, 1, wxEXPAND | wxLEFT, FromDIP(24)); + score_sizer->Add(0, 0, 1, wxEXPAND, 0); + return score_sizer; +} + +wxBoxSizer *ScoreDialog::get_star_sizer() +{ + wxBoxSizer *static_score_star_sizer = new wxBoxSizer(wxHORIZONTAL); + m_score_star.resize(5); + for (int i = 0; i < m_score_star.size(); ++i) { + if (!m_success_printed && m_star_count > 3) { + m_star_count = 3; + warning_text->Show(); + Layout(); + Fit(); + } + if (i < m_star_count) { + m_score_star[i] = new ScalableButton(this, wxID_ANY, "score_star_light", wxEmptyString, wxSize(FromDIP(26), FromDIP(26)), wxDefaultPosition, + wxBU_EXACTFIT | wxNO_BORDER, true, 26); + } else + m_score_star[i] = new ScalableButton(this, wxID_ANY, "score_star_dark", wxEmptyString, wxSize(FromDIP(26), FromDIP(26)), wxDefaultPosition, + wxBU_EXACTFIT | wxNO_BORDER, true, 26); + + m_score_star[i]->Bind(wxEVT_LEFT_DOWN, [this, i](auto &e) { + if (!m_success_printed && i >= 3) { + warning_text->Show(); + Layout(); + Fit(); + return; + } else { + warning_text->Hide(); + Layout(); + Fit(); + } + for (int j = 0; j < m_score_star.size(); ++j) { + ScalableBitmap light_star = ScalableBitmap(nullptr, "score_star_light", 26); + m_score_star[j]->SetBitmap(light_star.bmp()); + if (m_score_star[j] == m_score_star[i]) { + m_star_count = j + 1; + break; + } + } + for (int k = m_star_count; k < m_score_star.size(); ++k) { + ScalableBitmap dark_star = ScalableBitmap(nullptr, "score_star_dark", 26); + m_score_star[k]->SetBitmap(dark_star.bmp()); + } + }); + static_score_star_sizer->Add(m_score_star[i], 0, wxEXPAND | wxLEFT, FromDIP(20)); + } + + return static_score_star_sizer; +} + +wxBoxSizer* ScoreDialog::get_comment_text_sizer() { + wxBoxSizer* m_comment_sizer = new wxBoxSizer(wxHORIZONTAL); + wxStaticText *static_comment_text = new wxStaticText(this, wxID_ANY, _L("Comment"), wxDefaultPosition, wxDefaultSize, 0); + static_comment_text->Wrap(-1); + m_comment_sizer->Add(static_comment_text, 1, wxEXPAND | wxLEFT, FromDIP(24)); + m_comment_sizer->Add(0, 0, 1, wxEXPAND, 0); + return m_comment_sizer; +} + +void ScoreDialog::create_comment_text(const wxString& comment) { + m_comment_text = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(492), FromDIP(104)), wxTE_MULTILINE); + if (wxGetApp().dark_mode()) { + m_comment_text->SetForegroundColour(wxColor(*wxWHITE)); + } else + m_comment_text->SetForegroundColour(wxColor(*wxBLACK)); + if (!comment.empty()) { + m_comment_text->SetValue(comment); + } + m_comment_text->SetHint(_L("Rate this print")); + m_comment_text->SetBackgroundColour(*wxWHITE); + //m_comment_text->SetForegroundColour(wxColor("#BBBBBB")); + m_comment_text->SetMinSize(wxSize(FromDIP(492), FromDIP(104))); + + m_comment_text->Bind(wxEVT_SET_FOCUS, [this](auto &event) { + if (wxGetApp().dark_mode()) { + m_comment_text->SetForegroundColour(wxColor(*wxWHITE)); + } else + m_comment_text->SetForegroundColour(wxColor(*wxBLACK)); + m_comment_text->Refresh(); + event.Skip(); + }); +} + +wxBoxSizer *ScoreDialog::get_photo_btn_sizer() { + wxBoxSizer * m_photo_sizer = new wxBoxSizer(wxHORIZONTAL); + ScalableBitmap little_photo = wxGetApp().dark_mode() ? ScalableBitmap(this, "single_little_photo_dark", 20) : ScalableBitmap(this, "single_little_photo", 20); + wxStaticBitmap *little_photo_img = new wxStaticBitmap(this, wxID_ANY, little_photo.bmp(), wxDefaultPosition, wxSize(FromDIP(20), FromDIP(20)), 0); + m_photo_sizer->Add(little_photo_img, 0, wxEXPAND | wxLEFT, FromDIP(24)); + m_add_photo = new Label(this, _L("Add Photo")); + m_add_photo->SetBackgroundColour(*wxWHITE); + //m_add_photo->SetForegroundColour(wxColor("#898989")); + m_add_photo->SetSize(wxSize(-1, FromDIP(20))); + m_photo_sizer->Add(m_add_photo, 0, wxEXPAND | wxLEFT, FromDIP(12)); + + m_delete_photo = new Label(this, _L("Delete Photo")); + m_delete_photo->SetBackgroundColour(*wxWHITE); + //m_delete_photo->SetForegroundColour(wxColor("#898989")); + m_delete_photo->SetSize(wxSize(-1, FromDIP(20))); + m_photo_sizer->Add(m_delete_photo, 0, wxEXPAND | wxLEFT, FromDIP(12)); + m_delete_photo->Hide(); + m_photo_sizer->Add(0, 0, 1, wxEXPAND, 0); + + m_add_photo->Bind(wxEVT_LEFT_DOWN, [this](auto &e) { + // add photo logic + wxFileDialog openFileDialog(this, "Select Images", "", "", "Image files (*.png;*.jpg)|*.png;*.jpg", wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE); + + if (openFileDialog.ShowModal() == wxID_CANCEL) return; + + wxArrayString filePaths; + openFileDialog.GetPaths(filePaths); + //wxArrayString filePaths_reduction; + std::vector> local_path; + for (int i = 0; i < filePaths.GetCount(); i++) { //It's ugly, but useful + bool is_repeat = false; + for (auto image : m_image) { + if (filePaths[i] == image.second.local_image_url) { + is_repeat = true; + continue; + } + } + if (!is_repeat) { + local_path.push_back(std::make_pair(filePaths[i], "")); + if (local_path.size() + m_image.size() > m_photo_nums) { + break; + } + } + + } + + load_photo(local_path); + + m_image_sizer->Layout(); + this->Fit(); + this->Layout(); + }); + + m_delete_photo->Bind(wxEVT_LEFT_DOWN, [this](auto &e) { + for (auto it = m_selected_image_list.begin(); it != m_selected_image_list.end();) { + auto bitmap = *it; + m_image_sizer->Detach(m_image[bitmap].image_tb_broad); + m_image[bitmap].image_tb_broad->DeleteWindows(); + + m_image.erase(bitmap); + it = m_selected_image_list.erase(it); + } + m_image_url_paths.clear(); + for (const std::pair &bitmap : m_image) { + if (bitmap.second.is_uploaded) { + if (!bitmap.second.img_url_paths.empty()) { + m_image_url_paths.push_back(bitmap.second.img_url_paths); + } + } + } + m_delete_photo->Hide(); + Layout(); + Fit(); + }); + + return m_photo_sizer; +} + +wxBoxSizer *ScoreDialog::get_button_sizer() +{ + wxBoxSizer *bSizer_button = new wxBoxSizer(wxHORIZONTAL); + bSizer_button->Add(0, 0, 1, wxEXPAND, 0); + + StateColor btn_bg_green(std::pair(wxColour(27, 136, 68), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), + std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal)); + + m_button_ok = new Button(this, _L("Submit")); + m_button_ok->SetBackgroundColor(btn_bg_green); + m_button_ok->SetBorderColor(*wxWHITE); + m_button_ok->SetTextColor(wxColour(0xFFFFFE)); + m_button_ok->SetFont(Label::Body_12); + m_button_ok->SetSize(wxSize(FromDIP(58), FromDIP(24))); + m_button_ok->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + m_button_ok->SetCornerRadius(FromDIP(12)); + bSizer_button->Add(m_button_ok, 0, wxRIGHT, FromDIP(24)); + + m_button_ok->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { + m_upload_status_code = StatusCode::UPLOAD_PROGRESS; + + if (m_star_count == 0) { + MessageDialog dlg(this, _L("Please click on the star first."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("InFo"), wxOK); + dlg.ShowModal(); + return; + } + + std::set> need_upload_images = add_need_upload_imgs(); + + std::string comment = into_u8(m_comment_text->GetValue()); + unsigned int http_code; + std::string http_error; + wxString error_info; + + if (!need_upload_images.empty()) { + std::string config; + int ret = wxGetApp().getAgent()->get_oss_config(config, wxGetApp().app_config->get_country_code(), http_code, http_error); + if (ret == -1) { + error_info += into_u8(_L("Get oss config failed.")) + "\n\thttp code: " + std::to_string(http_code) + "\n\thttp error: " + http_error; + m_upload_status_code = StatusCode::UPLOAD_EXIST_ISSUE; + } + if (m_upload_status_code == StatusCode::UPLOAD_PROGRESS) { + int need_upload_nums = need_upload_images.size(); + int upload_nums = 0; + int upload_failed_nums = 0; + ProgressDialog *progress_dialog = new ProgressDialog(_L("Upload Pictrues"), _L("Number of images successfully uploaded") + ": " + std::to_string(upload_nums) + "/" + std::to_string(need_upload_nums), need_upload_nums, this); + for (std::set>::iterator it = need_upload_images.begin(); it != need_upload_images.end();) { + std::pair need_upload = *it; + std::string need_upload_uf8 = into_u8(need_upload.second); + //Local path when incoming, cloud path when outgoing + ret = wxGetApp().getAgent()->put_rating_picture_oss(config, need_upload_uf8, m_model_id, m_profile_id, http_code, http_error); + std::unordered_map::iterator iter; + switch (ret) { + case 0: + upload_nums++; + iter = m_image.find(need_upload.first); + if (m_image.end() != iter) { + iter->second.img_url_paths = need_upload_uf8; + iter->second.is_uploaded = true; + m_image_url_paths.push_back(need_upload_uf8); + } + it++; + progress_dialog->Update(upload_nums, _L("Number of images successfully uploaded") + ": " + std::to_string(upload_nums) + "/" + std::to_string(need_upload_nums)); + progress_dialog->Fit(); + BOOST_LOG_TRIVIAL(info) << "put_rating_picture_oss: model_id [" << m_model_id << "] profile_id [" << m_profile_id << "] http_code [" << http_code + << "] http_error [" << http_error << "] config [" << config << "] image_path [" << need_upload.second << "]"; + break; + case -1: + error_info += need_upload.second + _L(" upload failed").ToUTF8().data() + "\n\thttp code:" + std::to_string(http_code) + "\n\thttp_error:" + http_error + "\n"; + m_upload_status_code = StatusCode::UPLOAD_IMG_FAILED; + ++it; + break; + case BAMBU_NETWORK_ERR_PARSE_CONFIG_FAILED: + error_info += need_upload.second + _L(" upload config prase failed\n").ToUTF8().data() + "\n"; + m_upload_status_code = StatusCode::UPLOAD_IMG_FAILED; + ++it; + break; + case BAMBU_NETWORK_ERR_NO_CORRESPONDING_BUCKET: + error_info += need_upload.second + _L(" No corresponding storage bucket\n").ToUTF8().data() + "\n"; + m_upload_status_code = StatusCode::UPLOAD_IMG_FAILED; + ++it; + break; + case BAMBU_NETWORK_ERR_OPEN_FILE_FAILED: + error_info += need_upload.second + _L(" can not be opened\n").ToUTF8().data() + "\n"; + m_upload_status_code = StatusCode::UPLOAD_IMG_FAILED; + ++it; + break; + } + } + progress_dialog->Hide(); + if (progress_dialog) { + delete progress_dialog; + progress_dialog = nullptr; + } + + if (m_upload_status_code == StatusCode::UPLOAD_IMG_FAILED) { + std::string upload_failed_images = into_u8(_L("The following issues occurred during the process of uploading images. Do you want to ignore them?\n\n")); + MessageDialog dlg_info(this, upload_failed_images + error_info, wxString(_L("info")), wxOK | wxNO | wxCENTER); + if (dlg_info.ShowModal() == wxID_OK) { + m_upload_status_code = StatusCode::UPLOAD_PROGRESS; + } + } + } + } + + if (m_upload_status_code == StatusCode::UPLOAD_PROGRESS) { + int ret = wxGetApp().getAgent()->put_model_mall_rating(m_rating_id, m_star_count, comment, m_image_url_paths, http_code, http_error); + MessageDialog *dlg_info; + switch (ret) { + case 0: EndModal(wxID_OK); break; + case BAMBU_NETWORK_ERR_GET_RATING_ID_FAILED: + dlg_info = new MessageDialog(this, _L("Synchronizing the printing results. Please retry a few seconds later."), wxString(_L("info")), wxOK | wxCENTER); + dlg_info->ShowModal(); + delete dlg_info; + break; + default: // Upload failed and obtaining instance_id failed + if (ret == -1) + error_info += _L("Upload failed\n").ToUTF8().data(); + else + error_info += _L("obtaining instance_id failed\n").ToUTF8().data(); + if (!error_info.empty()) { BOOST_LOG_TRIVIAL(info) << error_info; } + + dlg_info = new MessageDialog(this, + _L("Your comment result cannot be uploaded due to some reasons. As follows:\n\n error code: ") + std::to_string(http_code) + + "\n " + _L("error message: ") + http_error + _L("\n\nWould you like to redirect to the webpage for rating?"), + wxString(_L("info")), wxOK | wxNO | wxCENTER); + if (dlg_info->ShowModal() == wxID_OK) { + market_model_scoring_page(m_design_id); + EndModal(wxID_OK); + } + delete dlg_info; + break; + } + } else if (m_upload_status_code == StatusCode::UPLOAD_IMG_FAILED) { + MessageDialog *dlg_info = new MessageDialog(this, _L("Some of your images failed to upload. Would you like to redirect to the webpage for rating?"), + wxString(_L("info")), wxOK | wxNO | wxCENTER); + if (dlg_info->ShowModal() == wxID_OK) { + market_model_scoring_page(m_design_id); + EndModal(wxID_OK); + } + delete dlg_info; + if (!error_info.empty()) { BOOST_LOG_TRIVIAL(info) << error_info; } + } + }); + + StateColor btn_bg_white(std::pair(wxColour(206, 206, 206), StateColor::Pressed), std::pair(wxColour(238, 238, 238), StateColor::Hovered), + std::pair(*wxWHITE, StateColor::Normal)); + + m_button_cancel = new Button(this, _L("Cancel")); + m_button_cancel->SetBackgroundColor(btn_bg_white); + m_button_cancel->SetBorderColor(wxColour(38, 46, 48)); + m_button_cancel->SetFont(Label::Body_12); + m_button_cancel->SetSize(wxSize(FromDIP(58), FromDIP(24))); + m_button_cancel->SetMinSize(wxSize(FromDIP(58), FromDIP(24))); + m_button_cancel->SetCornerRadius(FromDIP(12)); + bSizer_button->Add(m_button_cancel, 0, wxRIGHT, FromDIP(24)); + + m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) { EndModal(wxID_CANCEL); }); + + return bSizer_button; +} + +void ScoreDialog::load_photo(const std::vector> &filePaths) +{ + for (size_t i = 0; i < filePaths.size(); ++i) { + if (m_image.size() < m_photo_nums) { + std::pair local_to_url_path = filePaths[i]; + wxString filePath = local_to_url_path.first; + + ImageMsg cur_image_msg; + + if (filePath.empty()) { // local img path is empty, oss url path is exist + std::string oss_url_path = local_to_url_path.second; + //to do: load oss image, create wxStaticBitmap + + if (!oss_url_path.empty()) { + m_image.insert(create_oss_thumbnail(oss_url_path)); + } + continue; + } else { + m_image.insert(create_local_thumbnail(filePath)); + } + + } else { + MessageDialog *dlg_info_up_to_8 = new MessageDialog(this, _L("You can select up to 16 images."), wxString(_L("info")), wxOK | wxCENTER); + dlg_info_up_to_8->ShowModal(); + break; + } + + } +} + +wxBoxSizer *ScoreDialog::get_main_sizer(const std::vector> &images, const wxString &comment) +{ + init(); + wxBoxSizer *m_main_sizer = new wxBoxSizer(wxVERTICAL); + // top line + auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); + m_line_top->SetBackgroundColour(wxColour(0xA6, 0xa9, 0xAA)); + m_main_sizer->Add(m_line_top, 0, wxEXPAND, 0); + m_main_sizer->Add(0, 0, 0, wxTOP, FromDIP(32)); + + warning_text = new wxStaticText(this, wxID_ANY, _L("At least one successful print record of this print profile is required \nto give a positive rating(4 or 5stars).")); + warning_text->SetForegroundColour(*wxRED); + warning_text->SetFont(::Label::Body_13); + + wxBoxSizer *score_sizer = get_score_sizer(); + m_main_sizer->Add(score_sizer, 0, wxEXPAND, FromDIP(20)); + m_main_sizer->Add(0, 0, 0, wxBOTTOM, FromDIP(8)); + + wxBoxSizer *static_score_star_sizer = get_star_sizer(); + m_main_sizer->Add(static_score_star_sizer, 0, wxEXPAND | wxBOTTOM, FromDIP(20)); + + m_main_sizer->Add(warning_text, 0, wxEXPAND | wxLEFT, FromDIP(24)); + m_main_sizer->Add(0, 0, 0, wxBOTTOM, FromDIP(8)); + warning_text->Hide(); + + wxBoxSizer *m_comment_sizer = get_comment_text_sizer(); + m_main_sizer->Add(m_comment_sizer, 0, wxEXPAND, FromDIP(20)); + m_main_sizer->Add(0, 0, 0, wxBOTTOM, FromDIP(8)); + + create_comment_text(comment); + m_main_sizer->Add(m_comment_text, 0, wxLEFT, FromDIP(24)); + + wxBoxSizer *m_photo_sizer = get_photo_btn_sizer(); + m_main_sizer->Add(m_photo_sizer, 0, wxEXPAND | wxTOP, FromDIP(8)); + + m_image_sizer = new wxGridSizer(5, FromDIP(5), FromDIP(5)); + if (!images.empty()) { + load_photo(images); + } + m_main_sizer->Add(m_image_sizer, 0, wxEXPAND | wxLEFT, FromDIP(24)); + m_main_sizer->Add(0, 0, 1, wxEXPAND, 0); + + wxBoxSizer *bSizer_button = get_button_sizer(); + m_main_sizer->Add(bSizer_button, 0, wxEXPAND | wxBOTTOM, FromDIP(24)); + + return m_main_sizer; +} + +ScoreData ScoreDialog::get_score_data() { + ScoreData score_data; + score_data.rating_id = m_rating_id; + score_data.design_id = m_design_id; + score_data.model_id = m_model_id; + score_data.profile_id = m_profile_id; + score_data.star_count = m_star_count; + score_data.success_printed = m_success_printed; + score_data.comment_text = m_comment_text->GetValue(); + score_data.image_url_paths = m_image_url_paths; + for (auto img : m_image) { score_data.local_to_url_image.push_back(std::make_pair(img.second.local_image_url, img.second.img_url_paths)); } + + return score_data; +} + +void ScoreDialog::set_comment(std::string comment) +{ + if (m_comment_text) { + + m_comment_text->SetValue(wxString::FromUTF8(comment)); + } +} + +void ScoreDialog::set_cloud_bitmap(std::vector cloud_bitmaps) +{ + m_image_url_paths = cloud_bitmaps; + for (std::string &url : cloud_bitmaps) { + if (std::string::npos == url.find(m_model_id)) continue; + m_image.insert(create_oss_thumbnail(url)); + } + Layout(); + Fit(); +} + +} // namespace GUI +} // namespace Slic3r diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index 4879cb86f..6b7d4eef7 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -61,12 +61,102 @@ enum PrintingTaskType { CALIBRATION, }; +struct ScoreData +{ + int rating_id; + int design_id; + std::string model_id; + int profile_id; + int star_count; + bool success_printed; + wxString comment_text; + std::vector image_url_paths; + std::set need_upload_images; + std::vector> local_to_url_image; +}; + +typedef std::function OnGetSubTaskFn; + +class ScoreDialog : public GUI::DPIDialog +{ +public: + ScoreDialog(wxWindow *parent, int design_id, std::string model_id, int profile_id, int rating_id, bool success_printed, int star_count = 0); + ScoreDialog(wxWindow *parent, ScoreData *score_data); + ~ScoreDialog(); + + int get_rating_id() { return m_rating_id; } + ScoreData get_score_data(); + void set_comment(std::string comment); + void set_cloud_bitmap(std::vector cloud_bitmaps); + +protected: + enum StatusCode { + UPLOAD_PROGRESS = 0, + UPLOAD_EXIST_ISSUE, + UPLOAD_IMG_FAILED, + CODE_NUMBER + }; + + std::shared_ptr m_tocken; + const int m_photo_nums = 16; + int m_rating_id; + int m_design_id; + std::string m_model_id; + int m_profile_id; + int m_star_count; + bool m_success_printed; + std::vector m_image_url_paths; + StatusCode m_upload_status_code; + + struct ImageMsg + { + wxString local_image_url; //local image path + std::string img_url_paths; // oss url path + vector image_broad; + bool is_selected; + bool is_uploaded; // load + wxBoxSizer * image_tb_broad = nullptr; + }; + + std::vector m_score_star; + wxTextCtrl * m_comment_text = nullptr; + Button * m_button_ok = nullptr; + Button * m_button_cancel = nullptr; + Label * m_add_photo = nullptr; + Label * m_delete_photo = nullptr; + wxGridSizer * m_image_sizer = nullptr; + wxStaticText * warning_text = nullptr; + std::unordered_map m_image; + std::unordered_set m_selected_image_list; + + void init(); + void update_static_bitmap(wxStaticBitmap *static_bitmap, wxImage image); + void create_comment_text(const wxString &comment = ""); + void load_photo(const std::vector> &filePaths); + void on_dpi_changed(const wxRect &suggested_rect) override; + void OnBitmapClicked(wxMouseEvent &event); + + wxBoxSizer * create_broad_sizer(wxStaticBitmap *bitmap, ImageMsg &cur_image_msg); + wxBoxSizer * get_score_sizer(); + wxBoxSizer * get_star_sizer(); + wxBoxSizer * get_comment_text_sizer(); + wxBoxSizer * get_photo_btn_sizer(); + wxBoxSizer * get_button_sizer(); + wxBoxSizer * get_main_sizer(const std::vector> &images = std::vector>(), const wxString &comment = ""); + + std::set> add_need_upload_imgs(); + std::pair create_local_thumbnail(wxString &local_path); + std::pair create_oss_thumbnail(std::string &oss_path); + +}; + class PrintingTaskPanel : public wxPanel { public: PrintingTaskPanel(wxWindow* parent, PrintingTaskType type); ~PrintingTaskPanel(); void create_panel(wxWindow* parent); + private: MachineObject* m_obj; @@ -91,6 +181,7 @@ private: // Orca: show print end time wxStaticText * m_staticText_progress_end; wxStaticText* m_staticText_layers; + wxStaticText * m_has_rated_prompt; wxStaticBitmap* m_bitmap_thumbnail; wxStaticBitmap* m_bitmap_static_use_time; wxStaticBitmap* m_bitmap_static_use_weight; @@ -98,6 +189,12 @@ private: ScalableButton* m_button_abort; Button* m_button_market_scoring; Button* m_button_clean; + wxPanel * m_score_subtask_info; + wxPanel * m_score_staticline; + // score page + int m_star_count; + std::vector m_score_star; + bool m_star_count_dirty = false; ProgressBar* m_gauge_progress; Label* m_error_text; @@ -122,6 +219,8 @@ public: void update_layers_num(bool show, wxString num = wxEmptyString); void show_priting_use_info(bool show, wxString time = wxEmptyString, wxString weight = wxEmptyString); void show_profile_info(bool show, wxString profile = wxEmptyString); + void market_scoring_show(); + void market_scoring_hide(); public: ScalableButton* get_abort_button() {return m_button_abort;}; @@ -129,6 +228,13 @@ public: Button* get_market_scoring_button() {return m_button_market_scoring;}; Button* get_clean_button() {return m_button_clean;}; wxStaticBitmap* get_bitmap_thumbnail() {return m_bitmap_thumbnail;}; + int get_star_count() { return m_star_count; } + void set_star_count(int star_count); + std::vector &get_score_star() { return m_score_star; } + bool get_star_count_dirty() { return m_star_count_dirty; } + void set_star_count_dirty(bool dirty) { m_star_count_dirty = dirty; } + void set_has_reted_text(bool has_rated); + }; class StatusBasePanel : public wxScrolledWindow @@ -210,7 +316,6 @@ protected: ScalableButton *m_button_pause_resume; ScalableButton *m_button_abort; Button * m_button_clean; - Button * m_button_market_scoring; wxStaticText * m_text_tasklist_caption; @@ -222,19 +327,22 @@ protected: /* TempInput */ wxBoxSizer * m_misc_ctrl_sizer; StaticBox* m_fan_panel; - TempInput * m_tempCtrl_nozzle; - int m_temp_nozzle_timeout {0}; StaticLine * m_line_nozzle; + TempInput* m_tempCtrl_nozzle; + int m_temp_nozzle_timeout{ 0 }; TempInput * m_tempCtrl_bed; int m_temp_bed_timeout {0}; - TempInput * m_tempCtrl_frame; + TempInput * m_tempCtrl_chamber; + int m_temp_chamber_timeout {0}; bool m_current_support_cham_fan{true}; + bool m_current_support_aux_fan{true}; FanSwitchButton *m_switch_nozzle_fan; int m_switch_nozzle_fan_timeout{0}; FanSwitchButton *m_switch_printing_fan; int m_switch_printing_fan_timeout{0}; FanSwitchButton *m_switch_cham_fan; int m_switch_cham_fan_timeout{0}; + wxPanel* m_switch_block_fan; float m_fixed_aspect_ratio{1.8}; @@ -320,7 +428,7 @@ public: wxBoxSizer *create_ams_group(wxWindow *parent); wxBoxSizer *create_settings_group(wxWindow *parent); - void show_ams_group(bool show = true, bool support_virtual_tray = true, bool support_extrustion_cali = true); + void show_ams_group(bool show = true); }; @@ -359,10 +467,14 @@ protected: int m_last_vcamera = -1; bool m_is_load_with_temp = false; bool m_print_finish = false; + json m_rating_result; + json m_last_result; wxWebRequest web_request; bool bed_temp_input = false; bool nozzle_temp_input = false; + bool cham_temp_input = false; + bool request_model_info_flag = false; int speed_lvl = 1; // 0 - 3 int speed_lvl_timeout {0}; boost::posix_time::ptime speed_dismiss_time; @@ -372,6 +484,8 @@ protected: std::map m_print_connect_types; std::vector