From bfb0ffc745ee6546e7efdba618d0e7c0f4c909cd Mon Sep 17 00:00:00 2001 From: Prusa Research Date: Mon, 18 Sep 2023 12:23:07 +0200 Subject: [PATCH] Release v5.0.0 --- CMakePresets.json | 258 +- ProjectOptions.cmake | 5 +- include/buddy/lwipopts.h | 4 + include/marlin/Configuration_MINI_adv.h | 7 - include/marlin/Configuration_MK3.5.h | 6 +- include/marlin/Configuration_MK3.5_adv.h | 30 +- include/marlin/Configuration_MK4.h | 41 +- include/marlin/Configuration_MK4_adv.h | 98 +- include/marlin/Configuration_XL_Dwarf_adv.h | 37 +- include/marlin/Configuration_XL_adv.h | 7 - include/marlin/Configuration_iX.h | 12 +- include/marlin/Configuration_iX_adv.h | 53 +- include/tasks.hpp | 23 +- .../precise_stepping/precise_stepping.cpp | 13 +- .../src/feature/prusa/crash_recovery.cpp | 41 +- .../src/feature/prusa/crash_recovery.hpp | 2 + lib/Marlin/Marlin/src/feature/tmc_util.cpp | 10 +- lib/Marlin/Marlin/src/gcode/calibrate/G28.cpp | 20 +- lib/Marlin/Marlin/src/module/motion.cpp | 25 +- lib/Marlin/Marlin/src/module/motion.h | 1 - .../Marlin/src/module/prusa/homing_cart.cpp | 176 +- .../Marlin/src/module/prusa/homing_cart.hpp | 2 +- .../Marlin/src/module/prusa/homing_utils.cpp | 7 +- .../Marlin/src/module/stepper/trinamic.cpp | 60 +- lib/WUI/CMakeLists.txt | 6 +- lib/WUI/nhttp/gcode_upload.cpp | 51 +- lib/WUI/nhttp/gcode_upload.h | 1 + lib/WUI/nhttp/handler.h | 10 +- lib/WUI/nhttp/server.cpp | 18 +- lib/WUI/nhttp/server.h | 4 + lib/WUI/wui.cpp | 2 + src/buddy/main.cpp | 16 +- src/buddy/usb_device.cpp | 61 +- src/common/CMakeLists.txt | 2 + src/common/PersistentStorage.cpp | 16 +- src/common/gcode/gcode_info.cpp | 58 +- src/common/gcode/gcode_info.hpp | 48 +- src/common/homing_reporter.cpp | 3 + src/common/homing_reporter.hpp | 45 + src/common/hx717.h | 16 + src/common/marlin_print_preview.cpp | 11 +- src/common/selftest/i_selftest_part.hpp | 2 +- .../selftest/include_MK4/printer_selftest.hpp | 1 + src/common/selftest/selftest_MK4.cpp | 13 +- src/common/selftest/selftest_XL.cpp | 6 +- src/common/selftest/selftest_axis.cpp | 166 +- src/common/selftest/selftest_axis.h | 50 +- src/common/selftest/selftest_axis_config.hpp | 1 + .../selftest/selftest_axis_interface.cpp | 69 +- .../selftest/selftest_axis_interface.hpp | 7 +- src/common/selftest/selftest_dock.cpp | 8 +- src/common/selftest/selftest_dock.h | 2 + .../selftest/selftest_dock_interface.cpp | 2 + src/common/selftest/selftest_fan.cpp | 2 +- src/common/selftest/selftest_fan.h | 2 +- src/common/selftest/selftest_firstlayer.cpp | 6 +- src/common/selftest/selftest_firstlayer.hpp | 2 +- src/common/selftest/selftest_fsensor.cpp | 200 +- src/common/selftest/selftest_fsensor.h | 18 +- .../selftest/selftest_fsensor_interface.cpp | 8 +- src/common/selftest/selftest_gears.cpp | 5 +- src/common/selftest/selftest_gears.hpp | 1 + src/common/selftest/selftest_loadcell.cpp | 8 +- src/common/selftest/selftest_loadcell.h | 2 +- src/common/selftest/selftest_loop_result.hpp | 28 +- src/common/selftest/selftest_part.cpp | 41 +- src/common/st25dv64k.cpp | 26 + src/common/st25dv64k.h | 2 + src/common/trinamic.cpp | 29 +- src/common/trinamic.h | 4 +- src/connect/CMakeLists.txt | 1 + src/connect/marlin_printer.cpp | 2 + src/connect/printer.cpp | 3 + src/connect/printer.hpp | 2 + src/connect/printer_type.cpp | 17 + src/connect/printer_type.hpp | 8 +- src/connect/registrator.cpp | 3 +- src/connect/render.cpp | 2 +- src/connect/tls/tls.cpp | 12 +- src/device/stm32f4/peripherals.cpp | 3 +- src/gui/CMakeLists.txt | 7 + src/gui/MItem_lan.cpp | 4 +- src/gui/MItem_menus.cpp | 2 +- src/gui/MItem_tools.cpp | 6 +- src/gui/MItem_tools.hpp | 4 +- .../radio_button_preview.cpp | 4 +- .../radio_button_preview.hpp | 2 + src/gui/dialogs/window_dlg_wait.cpp | 7 +- src/gui/dialogs/window_dlg_wait.hpp | 2 +- src/gui/fonts.cpp | 60 +- src/gui/footer/footer_item_heatbreak.cpp | 6 +- src/gui/footer/footer_items_heaters.cpp | 10 +- src/gui/footer/footer_items_heaters.hpp | 6 +- src/gui/footer/footer_items_nozzle_bed.cpp | 10 +- src/gui/guimain.cpp | 3 + src/gui/menu_vars.cpp | 4 - src/gui/menu_vars.h | 7 - src/gui/res/cc/font_10x18.hpp | 14403 -- src/gui/res/cc/font_12x12.hpp | 110 - src/gui/res/cc/font_8x12.hpp | 111 - src/gui/res/cc/font_8x13.hpp | 5007 - src/gui/res/cc/font_9x15.hpp | 7215 - src/gui/res/cc/font_9x16.hpp | 12803 -- .../{font_11x19.hpp => font_bold_11x19.hpp} | 2336 +- .../{font_30x53.hpp => font_bold_13x22.hpp} | 30574 +--- src/gui/res/cc/font_bold_30x53.hpp | 139923 +++++++++++++++ ...ont_9x16_new.hpp => font_regular_9x16.hpp} | 1474 +- .../res/fnt_png/font_11x19_bad_accents.png | Bin 9263 -> 0 bytes src/gui/res/fnt_png/font_11x19_preview.png | Bin 7529 -> 0 bytes src/gui/res/fnt_png/font_13x22.png | Bin 10619 -> 0 bytes src/gui/res/fnt_png/font_13x22_preview.png | Bin 8781 -> 0 bytes src/gui/res/fnt_png/font_30x53.png | Bin 21366 -> 0 bytes src/gui/res/fnt_png/font_30x53_preview.png | Bin 11867 -> 0 bytes src/gui/res/fnt_png/font_8x13.png | Bin 10389 -> 0 bytes src/gui/res/fnt_png/font_8x13_preview.png | Bin 4127 -> 0 bytes src/gui/res/fnt_png/font_9x15.png | Bin 2456 -> 0 bytes src/gui/res/fnt_png/font_9x15_preview.png | Bin 1517 -> 0 bytes src/gui/res/fnt_png/font_9x16.png | Bin 16436 -> 0 bytes src/gui/res/fnt_png/font_9x16_new.png | Bin 6850 -> 0 bytes src/gui/res/fnt_png/font_9x16_new_preview.png | Bin 5709 -> 0 bytes src/gui/res/fnt_png/font_9x16_preview.png | Bin 7593 -> 0 bytes src/gui/res/fnt_png/font_bold_11x19.png | Bin 0 -> 8591 bytes .../res/fnt_png/font_bold_11x19_preview.png | Bin 0 -> 7957 bytes src/gui/res/fnt_png/font_bold_13x22.png | Bin 0 -> 10175 bytes .../res/fnt_png/font_bold_13x22_preview.png | Bin 0 -> 9468 bytes src/gui/res/fnt_png/font_bold_30x53.png | Bin 0 -> 30671 bytes .../res/fnt_png/font_bold_30x53_preview.png | Bin 0 -> 28495 bytes src/gui/res/fnt_png/font_regular_9x16.png | Bin 0 -> 6598 bytes .../res/fnt_png/font_regular_9x16_preview.png | Bin 0 -> 6004 bytes .../res/fnt_src/LiberationMono-bold_11x19.png | Bin 0 -> 30668 bytes .../res/fnt_src/LiberationMono-bold_13x22.png | Bin 0 -> 35779 bytes .../res/fnt_src/LiberationMono-bold_30x53.png | Bin 0 -> 105247 bytes .../fnt_src/LiberationMono-regular_9x16.png | Bin 0 -> 23772 bytes .../screen_print_preview_base.cpp | 4 +- src/gui/screen_help_fw_update.cpp | 87 + src/gui/screen_help_fw_update.hpp | 25 + src/gui/screen_menu_connect.cpp | 2 +- ...creen_menu_experimental_settings_debug.cpp | 25 +- ...een_menu_experimental_settings_release.cpp | 2 +- src/gui/screen_menu_hardware.cpp | 34 + src/gui/screen_menu_hardware.hpp | 18 + src/gui/screen_menu_move.cpp | 7 +- src/gui/screen_menu_settings.cpp | 14 + src/gui/screen_menu_settings.hpp | 29 +- src/gui/screen_prusa_link.cpp | 3 +- src/gui/screen_qr_error.cpp | 8 +- src/gui/test/screen_test_HX711.cpp | 2 +- src/gui/wizard/selftest_frame_axis.cpp | 2 +- src/gui/wizard/selftest_frame_loadcell.cpp | 25 +- src/gui/wizard/selftest_frame_loadcell.hpp | 1 - .../wizard/selftest_frame_tool_offsets.cpp | 2 +- src/guiapi/include/WindowItemTempLabel.hpp | 2 +- src/guiapi/include/WindowMenuSpin.hpp | 12 +- src/guiapi/include/fnt-indices.ipp | 124 +- src/guiapi/include/menu_spin_config_types.hpp | 4 +- src/guiapi/src/WindowMenuSpin.cpp | 21 +- src/guiapi/src/display_helper.cpp | 4 +- .../src/menu_spin_config_with_units.cpp | 2 +- src/guiapi/src/text_roll.cpp | 1 - src/lang/CMakeLists.txt | 4 +- src/lang/po/Prusa-Firmware-Buddy.pot | 5192 +- src/lang/po/cs/Prusa-Firmware-Buddy_cs.po | 6037 +- src/lang/po/de/Prusa-Firmware-Buddy_de.po | 6193 +- src/lang/po/en/Prusa-Firmware-Buddy_en.po | 5991 +- src/lang/po/es/Prusa-Firmware-Buddy_es.po | 6069 +- src/lang/po/fr/Prusa-Firmware-Buddy_fr.po | 6047 +- src/lang/po/it/Prusa-Firmware-Buddy_it.po | 6100 +- src/lang/po/pl/Prusa-Firmware-Buddy_pl.po | 6044 +- src/lang/translation_provider_CPUFLASH.hpp | 2 +- src/lang/unaccent.cpp | 107 - src/lang/unaccent.hpp | 17 - src/marlin_stubs/CMakeLists.txt | 1 + src/marlin_stubs/M862_2.cpp | 2 +- src/marlin_stubs/M862_3.cpp | 2 +- src/marlin_stubs/MINI/CMakeLists.txt | 2 + src/marlin_stubs/MINI/configuration.hpp | 40 + src/marlin_stubs/MK3.5/CMakeLists.txt | 2 + src/marlin_stubs/MK3.5/configuration.hpp | 40 + src/marlin_stubs/MK4/CMakeLists.txt | 3 + src/marlin_stubs/MK4/configuration.cpp | 27 + src/marlin_stubs/MK4/configuration.hpp | 39 + src/marlin_stubs/XL/CMakeLists.txt | 2 + src/marlin_stubs/XL/configuration.hpp | 40 + src/marlin_stubs/iX/CMakeLists.txt | 2 + src/marlin_stubs/iX/configuration.hpp | 40 + .../config_store/constants.hpp | 2 + .../store_instances/config_store/defaults.hpp | 14 +- .../config_store/old_eeprom/eeprom_v10.hpp | 8 +- .../config_store/store_c_api.cpp | 69 +- .../config_store/store_c_api.h | 4 + .../config_store/store_definition.hpp | 13 +- src/transfers/CMakeLists.txt | 8 +- tests/stubs/printer_type.cpp | 7 + tests/unit/connect/CMakeLists.txt | 3 + tests/unit/connect/mock_printer.h | 1 + tests/unit/lang/translator/CMakeLists.txt | 2 +- tests/unit/lang/translator/fnt-indices.cpp | 22 + tests/unit/lang/translator/fnt-indices.hpp | 7 + tests/unit/lang/translator/provider.cpp | 9 +- tests/unit/lang/translator/provider.h | 1 - .../unit/lang/translator/providerCPUFLASH.cpp | 12 +- tests/unit/lib/WUI/nhttp/CMakeLists.txt | 9 +- utils/bin2cc.py | 33 +- utils/font.py | 11 +- utils/font_generation/README.md | 76 + utils/font_generation/script.sh | 25 + utils/lang.py | 6 + utils/presets/presets.json | 11 - 208 files changed, 192989 insertions(+), 72039 deletions(-) create mode 100644 src/common/homing_reporter.cpp create mode 100644 src/common/homing_reporter.hpp create mode 100644 src/connect/printer_type.cpp delete mode 100644 src/gui/res/cc/font_10x18.hpp delete mode 100644 src/gui/res/cc/font_12x12.hpp delete mode 100644 src/gui/res/cc/font_8x12.hpp delete mode 100644 src/gui/res/cc/font_8x13.hpp delete mode 100644 src/gui/res/cc/font_9x15.hpp delete mode 100644 src/gui/res/cc/font_9x16.hpp rename src/gui/res/cc/{font_11x19.hpp => font_bold_11x19.hpp} (90%) rename src/gui/res/cc/{font_30x53.hpp => font_bold_13x22.hpp} (54%) create mode 100644 src/gui/res/cc/font_bold_30x53.hpp rename src/gui/res/cc/{font_9x16_new.hpp => font_regular_9x16.hpp} (90%) delete mode 100644 src/gui/res/fnt_png/font_11x19_bad_accents.png delete mode 100644 src/gui/res/fnt_png/font_11x19_preview.png delete mode 100644 src/gui/res/fnt_png/font_13x22.png delete mode 100644 src/gui/res/fnt_png/font_13x22_preview.png delete mode 100644 src/gui/res/fnt_png/font_30x53.png delete mode 100644 src/gui/res/fnt_png/font_30x53_preview.png delete mode 100644 src/gui/res/fnt_png/font_8x13.png delete mode 100644 src/gui/res/fnt_png/font_8x13_preview.png delete mode 100644 src/gui/res/fnt_png/font_9x15.png delete mode 100644 src/gui/res/fnt_png/font_9x15_preview.png delete mode 100644 src/gui/res/fnt_png/font_9x16.png delete mode 100644 src/gui/res/fnt_png/font_9x16_new.png delete mode 100644 src/gui/res/fnt_png/font_9x16_new_preview.png delete mode 100644 src/gui/res/fnt_png/font_9x16_preview.png create mode 100644 src/gui/res/fnt_png/font_bold_11x19.png create mode 100644 src/gui/res/fnt_png/font_bold_11x19_preview.png create mode 100644 src/gui/res/fnt_png/font_bold_13x22.png create mode 100644 src/gui/res/fnt_png/font_bold_13x22_preview.png create mode 100644 src/gui/res/fnt_png/font_bold_30x53.png create mode 100644 src/gui/res/fnt_png/font_bold_30x53_preview.png create mode 100644 src/gui/res/fnt_png/font_regular_9x16.png create mode 100644 src/gui/res/fnt_png/font_regular_9x16_preview.png create mode 100644 src/gui/res/fnt_src/LiberationMono-bold_11x19.png create mode 100644 src/gui/res/fnt_src/LiberationMono-bold_13x22.png create mode 100644 src/gui/res/fnt_src/LiberationMono-bold_30x53.png create mode 100644 src/gui/res/fnt_src/LiberationMono-regular_9x16.png create mode 100644 src/gui/screen_help_fw_update.cpp create mode 100644 src/gui/screen_help_fw_update.hpp delete mode 100644 src/lang/unaccent.cpp delete mode 100644 src/lang/unaccent.hpp create mode 100644 src/marlin_stubs/MINI/CMakeLists.txt create mode 100644 src/marlin_stubs/MINI/configuration.hpp create mode 100644 src/marlin_stubs/MK3.5/CMakeLists.txt create mode 100644 src/marlin_stubs/MK3.5/configuration.hpp create mode 100644 src/marlin_stubs/MK4/CMakeLists.txt create mode 100644 src/marlin_stubs/MK4/configuration.cpp create mode 100644 src/marlin_stubs/MK4/configuration.hpp create mode 100644 src/marlin_stubs/XL/CMakeLists.txt create mode 100644 src/marlin_stubs/XL/configuration.hpp create mode 100644 src/marlin_stubs/iX/CMakeLists.txt create mode 100644 src/marlin_stubs/iX/configuration.hpp create mode 100644 tests/stubs/printer_type.cpp create mode 100644 tests/unit/lang/translator/fnt-indices.cpp create mode 100644 tests/unit/lang/translator/fnt-indices.hpp create mode 100644 utils/font_generation/README.md create mode 100755 utils/font_generation/script.sh diff --git a/CMakePresets.json b/CMakePresets.json index 23e90ba911..dfb89aeae6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -278,258 +278,6 @@ "name": "mk4_debug_boot", "generator": "Ninja", "binaryDir": "build-vscode-buddy", - "cacheVariables": { - "CMAKE_MAKE_PROGRAM": { - "type": "FILEPATH", - "value": "${sourceDir}/.dependencies/ninja-1.10.2/ninja" - }, - "CMAKE_EXPORT_COMPILE_COMMANDS": { - "type": "STRING", - "value": "ON" - }, - "PRINTER": { - "type": "STRING", - "value": "MK4" - }, - "BOARD": { - "type": "STRING", - "value": "" - }, - "BOARD_VERSION": { - "type": "STRING", - "value": "0.2.7" - }, - "PRESET_COMPILE_OPTIONS": { - "type": "STRING", - "value": "-DHAS_LDO_400_STEP -DHAS_PLANETARY_GEARBOX" - }, - "BOOTLOADER": { - "type": "STRING", - "value": "YES" - }, - "GENERATE_BBF": { - "type": "BOOL", - "value": "TRUE" - }, - "GENERATE_DFU": { - "type": "BOOL", - "value": "OFF" - }, - "SIGNING_KEY": { - "type": "FILEPATH", - "value": "" - }, - "CMAKE_TOOLCHAIN_FILE": { - "type": "FILEPATH", - "value": "${sourceDir}/cmake/GccArmNoneEabi.cmake" - }, - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Debug" - }, - "PROJECT_VERSION_SUFFIX": { - "type": "STRING", - "value": "" - }, - "PROJECT_VERSION_SUFFIX_SHORT": { - "type": "STRING", - "value": "" - } - } - }, - { - "name": "mk4_debug_noboot", - "generator": "Ninja", - "binaryDir": "build-vscode-buddy", - "cacheVariables": { - "CMAKE_MAKE_PROGRAM": { - "type": "FILEPATH", - "value": "${sourceDir}/.dependencies/ninja-1.10.2/ninja" - }, - "CMAKE_EXPORT_COMPILE_COMMANDS": { - "type": "STRING", - "value": "ON" - }, - "PRINTER": { - "type": "STRING", - "value": "MK4" - }, - "BOARD": { - "type": "STRING", - "value": "" - }, - "BOARD_VERSION": { - "type": "STRING", - "value": "0.2.7" - }, - "PRESET_COMPILE_OPTIONS": { - "type": "STRING", - "value": "-DHAS_LDO_400_STEP -DHAS_PLANETARY_GEARBOX" - }, - "BOOTLOADER": { - "type": "STRING", - "value": "NO" - }, - "GENERATE_BBF": { - "type": "BOOL", - "value": "FALSE" - }, - "GENERATE_DFU": { - "type": "BOOL", - "value": "OFF" - }, - "SIGNING_KEY": { - "type": "FILEPATH", - "value": "" - }, - "CMAKE_TOOLCHAIN_FILE": { - "type": "FILEPATH", - "value": "${sourceDir}/cmake/GccArmNoneEabi.cmake" - }, - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Debug" - }, - "PROJECT_VERSION_SUFFIX": { - "type": "STRING", - "value": "" - }, - "PROJECT_VERSION_SUFFIX_SHORT": { - "type": "STRING", - "value": "" - } - } - }, - { - "name": "mk4_release_boot", - "generator": "Ninja", - "binaryDir": "build-vscode-buddy", - "cacheVariables": { - "CMAKE_MAKE_PROGRAM": { - "type": "FILEPATH", - "value": "${sourceDir}/.dependencies/ninja-1.10.2/ninja" - }, - "CMAKE_EXPORT_COMPILE_COMMANDS": { - "type": "STRING", - "value": "ON" - }, - "PRINTER": { - "type": "STRING", - "value": "MK4" - }, - "BOARD": { - "type": "STRING", - "value": "" - }, - "BOARD_VERSION": { - "type": "STRING", - "value": "0.2.7" - }, - "PRESET_COMPILE_OPTIONS": { - "type": "STRING", - "value": "-DHAS_LDO_400_STEP -DHAS_PLANETARY_GEARBOX" - }, - "BOOTLOADER": { - "type": "STRING", - "value": "YES" - }, - "GENERATE_BBF": { - "type": "BOOL", - "value": "TRUE" - }, - "GENERATE_DFU": { - "type": "BOOL", - "value": "OFF" - }, - "SIGNING_KEY": { - "type": "FILEPATH", - "value": "" - }, - "CMAKE_TOOLCHAIN_FILE": { - "type": "FILEPATH", - "value": "${sourceDir}/cmake/GccArmNoneEabi.cmake" - }, - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Release" - }, - "PROJECT_VERSION_SUFFIX": { - "type": "STRING", - "value": "" - }, - "PROJECT_VERSION_SUFFIX_SHORT": { - "type": "STRING", - "value": "" - } - } - }, - { - "name": "mk4_release_noboot", - "generator": "Ninja", - "binaryDir": "build-vscode-buddy", - "cacheVariables": { - "CMAKE_MAKE_PROGRAM": { - "type": "FILEPATH", - "value": "${sourceDir}/.dependencies/ninja-1.10.2/ninja" - }, - "CMAKE_EXPORT_COMPILE_COMMANDS": { - "type": "STRING", - "value": "ON" - }, - "PRINTER": { - "type": "STRING", - "value": "MK4" - }, - "BOARD": { - "type": "STRING", - "value": "" - }, - "BOARD_VERSION": { - "type": "STRING", - "value": "0.2.7" - }, - "PRESET_COMPILE_OPTIONS": { - "type": "STRING", - "value": "-DHAS_LDO_400_STEP -DHAS_PLANETARY_GEARBOX" - }, - "BOOTLOADER": { - "type": "STRING", - "value": "NO" - }, - "GENERATE_BBF": { - "type": "BOOL", - "value": "FALSE" - }, - "GENERATE_DFU": { - "type": "BOOL", - "value": "OFF" - }, - "SIGNING_KEY": { - "type": "FILEPATH", - "value": "" - }, - "CMAKE_TOOLCHAIN_FILE": { - "type": "FILEPATH", - "value": "${sourceDir}/cmake/GccArmNoneEabi.cmake" - }, - "CMAKE_BUILD_TYPE": { - "type": "STRING", - "value": "Release" - }, - "PROJECT_VERSION_SUFFIX": { - "type": "STRING", - "value": "" - }, - "PROJECT_VERSION_SUFFIX_SHORT": { - "type": "STRING", - "value": "" - } - } - }, - { - "name": "mk3.9_debug_boot", - "generator": "Ninja", - "binaryDir": "build-vscode-buddy", "cacheVariables": { "CMAKE_MAKE_PROGRAM": { "type": "FILEPATH", @@ -590,7 +338,7 @@ } }, { - "name": "mk3.9_debug_noboot", + "name": "mk4_debug_noboot", "generator": "Ninja", "binaryDir": "build-vscode-buddy", "cacheVariables": { @@ -653,7 +401,7 @@ } }, { - "name": "mk3.9_release_boot", + "name": "mk4_release_boot", "generator": "Ninja", "binaryDir": "build-vscode-buddy", "cacheVariables": { @@ -716,7 +464,7 @@ } }, { - "name": "mk3.9_release_noboot", + "name": "mk4_release_noboot", "generator": "Ninja", "binaryDir": "build-vscode-buddy", "cacheVariables": { diff --git a/ProjectOptions.cmake b/ProjectOptions.cmake index 03baef95cd..8ca04bb7e1 100644 --- a/ProjectOptions.cmake +++ b/ProjectOptions.cmake @@ -260,7 +260,7 @@ set(PRINTERS_WITH_TOOLCHANGER "XL") set(PRINTERS_WITH_SIDE_FSENSOR "XL") set(PRINTERS_WITH_EMBEDDED_ESP32 "XL") set(PRINTERS_WITH_SIDE_LEDS "XL" "iX") -set(PRINTERS_WITH_TRANSLATIONS "MINI") +set(PRINTERS_WITH_TRANSLATIONS "MK4" "XL") set(PRINTERS_WITH_LOVE_BOARD "MK4" "iX") set(PRINTERS_WITH_MMU2 "MK4" "MK3.5") @@ -579,6 +579,9 @@ else() define_boolean_option(NETWORKING_BENCHMARK_ENABLED NO) endif() +# asyncio causes speed regressions so let's disable it for now +define_boolean_option(USE_ASYNCIO NO) + # define enabled features if(BOOTLOADER STREQUAL "YES" diff --git a/include/buddy/lwipopts.h b/include/buddy/lwipopts.h index 46f6758a11..27cf313210 100644 --- a/include/buddy/lwipopts.h +++ b/include/buddy/lwipopts.h @@ -85,6 +85,10 @@ extern "C" { #define LWIP_SO_RCVTIMEO 1 #define LWIP_SO_SNDTIMEO 1 +// Some attempts to "tune" it to use less memory in unstable network environment with many retries of new connections. +#define LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT 5000 /* 5s for closing a connection must be enough... or let the other side time out */ +#define TCP_OVERSIZE 0 + #define LWIP_DNS 1 /* * We have a HTTP server (PrusaLink). The browsers tend to keep few diff --git a/include/marlin/Configuration_MINI_adv.h b/include/marlin/Configuration_MINI_adv.h index 3539de761d..1086621076 100644 --- a/include/marlin/Configuration_MINI_adv.h +++ b/include/marlin/Configuration_MINI_adv.h @@ -480,13 +480,6 @@ //#define HALT_ON_PROBING_ERROR //after enabling HOMING_MAX_ATTEMPTS, homing can fail #define HOMING_MAX_ATTEMPTS 10 -#ifdef HOMING_MAX_ATTEMPTS - // ranges in mm - allowed distance between homing probes for XYZ axes - constexpr float axis_home_min_diff[] = {-0.2, -0.2, -0.1}; - constexpr float axis_home_max_diff[] = { 0.2, 0.2, 0.1}; - constexpr float axis_home_invert_min_diff[] = {-1, -1, -1}; - constexpr float axis_home_invert_max_diff[] = { 1, 1, 1}; -#endif// HOMING_MAX_ATTEMPTS // Homing hits each endstop, retracts by these distances, then does a slower bump. #define X_HOME_BUMP_MM 10 diff --git a/include/marlin/Configuration_MK3.5.h b/include/marlin/Configuration_MK3.5.h index 52fc0a33ed..044b779cbd 100644 --- a/include/marlin/Configuration_MK3.5.h +++ b/include/marlin/Configuration_MK3.5.h @@ -1100,12 +1100,11 @@ #define Z_END_GAP 10 // MK3.9 (200 step motors) does not support precise homing -#if defined(HAS_LDO_400_STEP) /** * Calibrates X, Y homing positions and uses * the reference to provide repeatable homing position. */ -#define PRECISE_HOMING +// #define PRECISE_HOMING /** * Number of precise homing tries @@ -1113,8 +1112,7 @@ * Three times more tries are used when recovering from crash * or power panic. */ -#define PRECISE_HOMING_TRIES 15 -#endif +// #define PRECISE_HOMING_TRIES 15 /** * Software Endstops diff --git a/include/marlin/Configuration_MK3.5_adv.h b/include/marlin/Configuration_MK3.5_adv.h index cd39807c2a..32f3c4683a 100644 --- a/include/marlin/Configuration_MK3.5_adv.h +++ b/include/marlin/Configuration_MK3.5_adv.h @@ -466,14 +466,6 @@ #define HOMING_MAX_ATTEMPTS 10 #endif -#ifdef HOMING_MAX_ATTEMPTS - // ranges in mm - allowed distance between homing probes for XYZ axes - constexpr float axis_home_min_diff[] = {-0.2, -0.2, -0.1}; - constexpr float axis_home_max_diff[] = { 0.2, 0.2, 0.5}; - constexpr float axis_home_invert_min_diff[] = {-1, -1, -1}; - constexpr float axis_home_invert_max_diff[] = { 1, 1, 1}; -#endif// HOMING_MAX_ATTEMPTS - // Homing hits each endstop, retracts by these distances, then does a slower bump. #define X_HOME_BUMP_MM 10 #define Y_HOME_BUMP_MM 10 @@ -1736,25 +1728,13 @@ // Milliseconds to wait on hold before auto-restarting during short power failures #define POWER_PANIC_HOLD_RST_MS 5000 - #ifdef HAS_LDO_400_STEP - // TODO: currently arbitrary, needs to include optimal feedrates too - #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking - #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) - - #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment - #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) + #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking + #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) - #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current - #else - // TODO: currently arbitrary - #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking - #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) + #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment + #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) - #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment - #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) - - #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current - #endif + #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current #endif /** diff --git a/include/marlin/Configuration_MK4.h b/include/marlin/Configuration_MK4.h index e23b5728fa..4a5b3f40c4 100644 --- a/include/marlin/Configuration_MK4.h +++ b/include/marlin/Configuration_MK4.h @@ -21,6 +21,8 @@ */ #pragma once +#include "hw_configuration.hpp" + // clang-format off /** @@ -753,17 +755,8 @@ * Override with M203 * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#if defined(HAS_LDO_400_STEP) - #define DEFAULT_MAX_FEEDRATE \ - { 400, 400, 40, 50 } - #define DEFAULT_MAX_FEEDRATE_STEALTHCHOP \ - { 100, 100, 40, 45 } -#else - #define DEFAULT_MAX_FEEDRATE \ - { 200, 200, 40, 45 } - #define DEFAULT_MAX_FEEDRATE_STEALTHCHOP \ - { 180, 165, 40, 45 } -#endif //HAS_LDO_400_STEP +#define DEFAULT_MAX_FEEDRATE \ + { 400, 400, 40, 50 } /** * Default Max Acceleration (change/s) change = mm/s @@ -1054,16 +1047,9 @@ #define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled // default values -#if defined(HAS_LDO_400_STEP) - #define DEFAULT_INVERT_X_DIR false - #define DEFAULT_INVERT_Y_DIR true - #define DEFAULT_INVERT_Z_DIR false -#else - // 200 step .. MK3.9 - #define DEFAULT_INVERT_X_DIR true - #define DEFAULT_INVERT_Y_DIR false - #define DEFAULT_INVERT_Z_DIR true -#endif +#define DEFAULT_INVERT_X_DIR false +#define DEFAULT_INVERT_Y_DIR true +#define DEFAULT_INVERT_Z_DIR false #if (!defined(HAS_PLANETARY_GEARBOX)) #define DEFAULT_INVERT_E0_DIR true @@ -1145,8 +1131,6 @@ #define Y_END_GAP 5 #define Z_END_GAP 10 -// MK3.9 (200 step motors) does not support precise homing -#if defined(HAS_LDO_400_STEP) /** * Calibrates X, Y homing positions and uses * the reference to provide repeatable homing position. @@ -1159,8 +1143,7 @@ * Three times more tries are used when recovering from crash * or power panic. */ -#define PRECISE_HOMING_TRIES 15 -#endif +#define PRECISE_HOMING_TRIES 12 /** * Software Endstops @@ -1443,13 +1426,7 @@ #define Z_SAFE_HOMING_Y_POINT (-4) // Y point for Z homing when homing all axes (G28). #endif -// Homing speeds (mm/m) -#ifdef HAS_LDO_400_STEP - #include "hw_configuration.hpp" - #define HOMING_FEEDRATE_XY (buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (80 * 60) : (62 * 60)) -#else - #define HOMING_FEEDRATE_XY (80 * 60)//(150 * 60) -#endif +#define HOMING_FEEDRATE_XY (buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (80 * 60) : (62 * 60)) #define HOMING_FEEDRATE_Z (8 * 60) #define HOMING_FEEDRATE_INVERTED_Z (buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (60 * 60) : (30 * 60)) diff --git a/include/marlin/Configuration_MK4_adv.h b/include/marlin/Configuration_MK4_adv.h index c0637eedfc..62ce7a9e50 100644 --- a/include/marlin/Configuration_MK4_adv.h +++ b/include/marlin/Configuration_MK4_adv.h @@ -466,19 +466,6 @@ #define HOMING_MAX_ATTEMPTS 10 #endif -#ifdef HOMING_MAX_ATTEMPTS - // ranges in mm - allowed distance between homing probes for XYZ axes -#ifdef HAS_LDO_400_STEP - constexpr float axis_home_min_diff[] = {-0.1, -0.1, -0.1}; - constexpr float axis_home_max_diff[] = { 0.1, 0.1, 0.5}; -#else - constexpr float axis_home_min_diff[] = {-0.2, -0.2, -0.1}; - constexpr float axis_home_max_diff[] = { 0.2, 0.2, 0.5}; -#endif - constexpr float axis_home_invert_min_diff[] = {-1, -1, -1}; - constexpr float axis_home_invert_max_diff[] = { 1, 1, 1}; -#endif// HOMING_MAX_ATTEMPTS - // Homing hits each endstop, retracts by these distances, then does a slower bump. #define X_HOME_BUMP_MM 10 #define Y_HOME_BUMP_MM 10 @@ -1530,20 +1517,17 @@ constexpr float HOLD_MULTIPLIER[4] = {1, 1, 1, 1}; // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #if defined(HAS_LDO_400_STEP) && (X_DRIVER_TYPE == TMC2130 && Y_DRIVER_TYPE == X_DRIVER_TYPE) + #if X_DRIVER_TYPE == TMC2130 && Y_DRIVER_TYPE == X_DRIVER_TYPE #define HAS_TMC_WAVETABLE // enable wavetable correction for this driver/motor type #endif #if AXIS_IS_TMC(X) - #if !defined HAS_LDO_400_STEP - //Multiply by 1.414 for peak current. - //#define X_CURRENT 290 // (mA) RMS current. Minebea - #define X_CURRENT 300 // (mA) RMS current. MK3 motors - #define X_MICROSTEPS 16 // 0..256 - #else - #define X_CURRENT 550 // (mA) RMS current. Multiply by 1.414 for peak current. - #define X_MICROSTEPS 8 // 0..256 - #endif + // Use 400_STEP values as default current and microstep. For 200 step motors (MK3.9) the values will + // be reconfigured in runtime if the printer is configured as MK3.9 in EEPROM. + #define X_400_STEP_CURRENT 550 + #define X_400_STEP_MICROSTEPS 8 // 0..256 + #define X_200_STEP_CURRENT 300 + #define X_200_STEP_MICROSTEPS 16 // 0..256 #define X_RSENSE 0.22 #define X_CHAIN_POS 0 #endif @@ -1555,14 +1539,12 @@ #endif #if AXIS_IS_TMC(Y) - #if !defined HAS_LDO_400_STEP - //#define Y_CURRENT 360 // Minebea - #define Y_CURRENT 370 // (mA) RMS current. MK3 motors - #define Y_MICROSTEPS 16 - #else - #define Y_CURRENT 700 - #define Y_MICROSTEPS 8 // 0..256 - #endif + // Use 400_STEP values as default current and microstep. For 200 step motors (MK3.9) the values will + // be reconfigured in runtime if the printer is configured as MK3.9 in EEPROM. + #define Y_400_STEP_CURRENT 700 + #define Y_400_STEP_MICROSTEPS 8 // 0..256 + #define Y_200_STEP_CURRENT 370 + #define Y_200_STEP_MICROSTEPS 16 // 0..256 #define Y_RSENSE 0.22 #define Y_CHAIN_POS 0 #endif @@ -1758,25 +1740,14 @@ // Milliseconds to wait on hold before auto-restarting during short power failures #define POWER_PANIC_HOLD_RST_MS 5000 - #ifdef HAS_LDO_400_STEP - // TODO: currently arbitrary, needs to include optimal feedrates too - #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking - #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) + // TODO: currently arbitrary, needs to include optimal feedrates too + #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking + #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) - #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment - #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) + #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment + #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) - #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current - #else - // TODO: currently arbitrary - #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking - #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) - - #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment - #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) - - #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current - #endif + #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current #endif /** @@ -1806,39 +1777,32 @@ #if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #if X_DRIVER_TYPE == TMC2130 - #if defined(HAS_LDO_400_STEP) - #include "hw_configuration.hpp" - #define X_STALL_SENSITIVITY buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (int16_t) -4 : (int16_t) -2 - #else - #define X_STALL_SENSITIVITY 3 - #endif + // The range of stallguard sensitivities to probe and calibrate + // (the required sensitivity varies by motor) + #define XY_STALL_SENSITIVITY_MIN -7 + #define XY_STALL_SENSITIVITY_MAX -2 + + // Read from config. May be int16 max if uncalibrated, which is + // then handled in the Crash_s class. + #define X_STALL_SENSITIVITY config_store().homing_sens_x.get() #elif X_DRIVER_TYPE == TMC2209 #define X_STALL_SENSITIVITY 140 #endif #if Y_DRIVER_TYPE == TMC2130 - #if defined(HAS_LDO_400_STEP) - #include "hw_configuration.hpp" - #define Y_STALL_SENSITIVITY buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (int16_t) -4 : (int16_t) -2 - #else - #define Y_STALL_SENSITIVITY 3 - #endif + // Read from config. May be int16 max if uncalibrated, which is + // then handled in the Crash_s class. + #define Y_STALL_SENSITIVITY config_store().homing_sens_y.get() #elif Y_DRIVER_TYPE == TMC2209 #define Y_STALL_SENSITIVITY 130 #endif #if Z_DRIVER_TYPE == TMC2130 - #include "hw_configuration.hpp" - #define Z_STALL_SENSITIVITY buddy::hw::Configuration::Instance().has_trinamic_oscillators() ? (int16_t) 1 : (int16_t) 3 + #define Z_STALL_SENSITIVITY 3 #elif Z_DRIVER_TYPE == TMC2209 #define Z_STALL_SENSITIVITY 100 #endif - #ifdef HAS_LDO_400_STEP - #define STALL_THRESHOLD_TMC2130 80 - #else - #define STALL_THRESHOLD_TMC2130 400 - #endif #define STALL_THRESHOLD_TMC2209 400 #define IMPROVE_HOMING_RELIABILITY diff --git a/include/marlin/Configuration_XL_Dwarf_adv.h b/include/marlin/Configuration_XL_Dwarf_adv.h index 749d28c511..94bfd5ac3b 100644 --- a/include/marlin/Configuration_XL_Dwarf_adv.h +++ b/include/marlin/Configuration_XL_Dwarf_adv.h @@ -21,6 +21,8 @@ */ #pragma once +#include + // clang-format off /** @@ -480,10 +482,37 @@ #define HOMING_MAX_ATTEMPTS 2 #ifdef HOMING_MAX_ATTEMPTS // ranges in mm - allowed distance between homing probes for XYZ axes - constexpr float axis_home_min_diff[] = {-0.2, -0.2, -0.1}; - constexpr float axis_home_max_diff[] = { 0.2, 0.2, 0.1}; - constexpr float axis_home_invert_min_diff[] = {-1, -1, -1}; - constexpr float axis_home_invert_max_diff[] = { 1, 1, 1}; + inline constexpr float axis_home_min_diff(uint8_t axis_num) { + if (axis_num >= 3) { + return NAN; + } + float arr[] = {-0.2, -0.2, -0.1}; + return arr[axis_num]; + } + + inline constexpr float axis_home_max_diff(uint8_t axis_num) { + if (axis_num >= 3) { + return NAN; + } + float arr[] = { 0.2, 0.2, 0.1}; + return arr[axis_num]; + } + + inline constexpr float axis_home_invert_min_diff(uint8_t axis_num) { + if (axis_num >= 3) { + return NAN; + } + float arr[] = {-1, -1, -1}; + return arr[axis_num]; + } + + inline constexpr float axis_home_invert_max_diff(uint8_t axis_num) { + if (axis_num >= 3) { + return NAN; + } + float arr[] = {1, 1, 1}; + return arr[axis_num]; + } #endif// HOMING_MAX_ATTEMPTS // Homing hits each endstop, retracts by these distances, then does a slower bump. diff --git a/include/marlin/Configuration_XL_adv.h b/include/marlin/Configuration_XL_adv.h index 48e6314dfe..93ec1d58ef 100644 --- a/include/marlin/Configuration_XL_adv.h +++ b/include/marlin/Configuration_XL_adv.h @@ -494,13 +494,6 @@ // Repeating single-axis homing #define HOMING_MAX_ATTEMPTS 10 -#ifdef HOMING_MAX_ATTEMPTS - // ranges in mm - allowed distance between homing probes for XYZ axes - constexpr float axis_home_min_diff[] = {-0.2, -0.2, -0.1}; - constexpr float axis_home_max_diff[] = { 0.2, 0.2, 0.5}; - constexpr float axis_home_invert_min_diff[] = {-1, -1, -1}; - constexpr float axis_home_invert_max_diff[] = { 1, 1, 1}; -#endif// HOMING_MAX_ATTEMPTS // Homing hits each endstop, retracts by these distances, then does a slower bump. #define X_HOME_BUMP_MM 20 diff --git a/include/marlin/Configuration_iX.h b/include/marlin/Configuration_iX.h index 4f931954b8..128726d032 100644 --- a/include/marlin/Configuration_iX.h +++ b/include/marlin/Configuration_iX.h @@ -756,15 +756,9 @@ * X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]] */ -#if !defined HAS_LDO_400_STEP - #define DEFAULT_AXIS_STEPS_PER_UNIT \ - { 100, 100, 800, 400 } -#else - #define DEFAULT_AXIS_STEPS_PER_UNIT \ - { 50, 50, 800, 784 } -#endif - - +// 200 step motors +#define DEFAULT_AXIS_STEPS_PER_UNIT \ + { 100, 100, 800, 400 } /** diff --git a/include/marlin/Configuration_iX_adv.h b/include/marlin/Configuration_iX_adv.h index 3e680e7653..29b3baa90b 100644 --- a/include/marlin/Configuration_iX_adv.h +++ b/include/marlin/Configuration_iX_adv.h @@ -462,13 +462,6 @@ //after enabling HOMING_MAX_ATTEMPTS, homing can fail #define HOMING_MAX_ATTEMPTS 10 -#ifdef HOMING_MAX_ATTEMPTS - //ranges in mm - allowed distance between homing probes - constexpr float axis_home_min_diff[] = {-3,-3,-0.5}; - constexpr float axis_home_max_diff[] = {3,3,0.5}; - constexpr float axis_home_invert_min_diff[] = {-1, -1, -1}; - constexpr float axis_home_invert_max_diff[] = { 1, 1, 1}; -#endif// HOMING_MAX_ATTEMPTS // Homing hits each endstop, retracts by these distances, then does a slower bump. #define X_HOME_BUMP_MM 20 @@ -1526,18 +1519,10 @@ constexpr float HOLD_MULTIPLIER[4] = {1, 1, 1, 1}; // Scales down the holding current from run current #define INTERPOLATE true // Interpolate X/Y/Z_MICROSTEPS to 256 - #if defined(HAS_LDO_400_STEP) && (X_DRIVER_TYPE == TMC2130 && Y_DRIVER_TYPE == X_DRIVER_TYPE) - #define HAS_TMC_WAVETABLE // enable wavetable correction for this driver/motor type - #endif - #if AXIS_IS_TMC(X) - #if !defined HAS_LDO_400_STEP - #define X_CURRENT 290 // (mA) RMS current. Multiply by 1.414 for peak current. - #define X_MICROSTEPS 16 // 0..256 - #else - #define X_CURRENT 550 // (mA) RMS current. Multiply by 1.414 for peak current. - #define X_MICROSTEPS 8 // 0..256 - #endif + // 200 step + #define X_CURRENT 290 // (mA) RMS current. Multiply by 1.414 for peak current. + #define X_MICROSTEPS 16 // 0..256 #define X_RSENSE 0.22 #define X_CHAIN_POS 0 #endif @@ -1549,13 +1534,9 @@ #endif #if AXIS_IS_TMC(Y) - #if !defined HAS_LDO_400_STEP - #define Y_CURRENT 360 - #define Y_MICROSTEPS 16 - #else - #define Y_CURRENT 600 - #define Y_MICROSTEPS 8 // 0..256 - #endif + // 200 step + #define Y_CURRENT 360 + #define Y_MICROSTEPS 16 #define Y_RSENSE 0.22 #define Y_CHAIN_POS 0 #endif @@ -1748,25 +1729,13 @@ #define POWER_PANIC_Z_LIFT_CYCLES 4 // 4xFullStep cycles = ~0.64mm #define POWER_PANIC_MAX_BED_DIFF 10 // Maximum bed temperature (C) difference for auto-recovery - #ifdef HAS_LDO_400_STEP - // TODO: currently arbitrary, needs to include optimal feedrates too - #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking - #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) + #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking + #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) - #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment - #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) + #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment + #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) - #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current - #else - // TODO: currently arbitrary - #define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking - #define POWER_PANIC_X_FEEDRATE 200 // (mm/s, running at POWER_PANIC_X_CURRENT) - - #define POWER_PANIC_Z_CURRENT 350 // (mA) RMS current _after_ alignment - #define POWER_PANIC_Z_FEEDRATE 50 // (mm/s, running at default current) - - #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current - #endif + #define POWER_PANIC_E_CURRENT 300 // (mA) RMS current #endif /** diff --git a/include/tasks.hpp b/include/tasks.hpp index 1780f7faef..868d373597 100644 --- a/include/tasks.hpp +++ b/include/tasks.hpp @@ -26,8 +26,11 @@ enum class Dependency { default_task_ready, usbserial_ready, esp_flashed, + lwip_initialized, manufacture_report_sent, +#ifdef USE_ASYNCIO async_io_ready, +#endif power_panic_initialized, _count @@ -36,10 +39,15 @@ enum class Dependency { // Check dependency mask fits into the dependency_t integer static_assert(ftrstd::to_underlying(Dependency::_count) <= sizeof(dependency_t) * 8); +#define NETWORK_DEPENDS_ON_ASYNCIO USE_ASYNCIO +#define NETWORK_DEPENDS_ON_ESP_FLASHED (HAS_EMBEDDED_ESP32() && BOARD_VER_HIGHER_OR_EQUAL_TO(0, 5, 0)) + // Create dependency mask from the dependencies enum constexpr dependency_t make(std::same_as auto... dependencies) { // Feel free to lift the assert in case some build configuration results in empty list +#if NETWORK_DEPENDS_ON_ASYNCIO || NETWORK_DEPENDS_ON_ESP_FLASHED static_assert(sizeof...(dependencies) > 0, "No dependencies, is this intended?"); +#endif return ((1 << ftrstd::to_underlying(dependencies)) | ... | 0); } @@ -53,15 +61,20 @@ namespace Tasks { inline constexpr dependency_t puppy_start = make(Dependency::resources_ready, Dependency::manufacture_report_sent); inline constexpr dependency_t puppy_run = make(Dependency::default_task_ready); inline constexpr dependency_t espif = make(Dependency::esp_flashed); + inline constexpr dependency_t connect = make(Dependency::lwip_initialized); inline constexpr dependency_t network = make( -#if HAS_EMBEDDED_ESP32() - #if BOARD_VER_HIGHER_OR_EQUAL_TO(0, 5, 0) +#if NETWORK_DEPENDS_ON_ESP_FLASHED // This is temporary, remove once everyone has compatible hardware. // Requires new sandwich rev. 06 or rev. 05 with R83 removed. - Dependency::esp_flashed, - #endif + Dependency::esp_flashed +#endif +#if NETWORK_DEPENDS_ON_ESP_FLASHED && NETWORK_DEPENDS_ON_ASYNCIO + , +#endif +#if NETWORK_DEPENDS_ON_ASYNCIO + Dependency::async_io_ready #endif - Dependency::async_io_ready); + ); } // namespace Tasks diff --git a/lib/Marlin/Marlin/src/feature/precise_stepping/precise_stepping.cpp b/lib/Marlin/Marlin/src/feature/precise_stepping/precise_stepping.cpp index 32557f072a..f6cf759da3 100644 --- a/lib/Marlin/Marlin/src/feature/precise_stepping/precise_stepping.cpp +++ b/lib/Marlin/Marlin/src/feature/precise_stepping/precise_stepping.cpp @@ -744,12 +744,8 @@ bool PreciseStepping::is_waiting_before_delivering() { if (const uint8_t waiting_for_discard = Planner::movesplanned_processed(); waiting_for_discard >= (BLOCK_BUFFER_SIZE / 2)) { // In case the block queue contains plenty of short blocks waiting for discarding and step generators are unable to produce new // step events, we have to ensure that the next block can be processed (or the empty move segment can be placed into the queue). - if (has_all_generators_reached_end_of_move_queue(PreciseStepping::step_generator_state)) { - // We reset indicators that all step generators reach the end of the queue to ensure that this - // condition will not be triggered multiple times before the move interrupt handler is called. - reset_reached_end_of_move_queue_flag(PreciseStepping::step_generator_state); + if (has_all_generators_reached_end_of_move_queue(PreciseStepping::step_generator_state)) return false; - } return true; } @@ -867,7 +863,12 @@ void PreciseStepping::move_isr() { // causes too few steps to be produced per iteration, eventually running it dry assert(status == STEP_GENERATOR_STATUS_NO_STEP_EVENT_PRODUCED); - for (;;) { + // Until we break from this loop, no new blocks are appended into the block queue. + // To ensure that we are never stuck in the infinite loop (when some unexpected state happens), + // we will limit the number of iterations by the number of all blocks + 1. + // +1 is there to make one additional call when all blocks are processed because this additional + // call can append the ending empty move segment when all blocks were already processed. + for (uint16_t i = 0; i <= Planner::movesplanned(); ++i) { process_queue_of_blocks(); if (!has_unprocessed_move_segments_queued()) { // the queue didn't avance: we're stuck diff --git a/lib/Marlin/Marlin/src/feature/prusa/crash_recovery.cpp b/lib/Marlin/Marlin/src/feature/prusa/crash_recovery.cpp index 255bfac61d..be9715f75a 100644 --- a/lib/Marlin/Marlin/src/feature/prusa/crash_recovery.cpp +++ b/lib/Marlin/Marlin/src/feature/prusa/crash_recovery.cpp @@ -330,10 +330,10 @@ void Crash_s::send_reports() { float speed = -1; if (axis_hit == X_AXIS) { - speed = period_to_speed(X_MICROSTEPS, int(stepperX.TSTEP()), get_steps_per_unit_x()); + speed = period_to_speed(get_microsteps_x(), int(stepperX.TSTEP()), get_steps_per_unit_x()); } if (axis_hit == Y_AXIS) { - speed = period_to_speed(Y_MICROSTEPS, int(stepperY.TSTEP()), get_steps_per_unit_y()); + speed = period_to_speed(get_microsteps_y(), int(stepperY.TSTEP()), get_steps_per_unit_y()); } static metric_t crash_metric = METRIC("crash", METRIC_VALUE_CUSTOM, 0, METRIC_HANDLER_ENABLE_ALL); @@ -415,21 +415,40 @@ void Crash_s::reset() { homefail_z = false; } +void Crash_s::set_homing_sensitivity(const AxisEnum axis) { + // If XY_STALL_SENSITIVITY_MIN is defined, we have stallguard sensitivity + // calibration (currently on MK4). In that case, the sensitivity in + // home_sensitivity can be "unset" (int16 max), and we want to fall back to + // XY_STALL_SENSITIVITY_MIN until the calibration is done and we have the + // right value. + #if defined(XY_STALL_SENSITIVITY_MIN) + auto sensitivity_fallback = [](int16_t s) { + return s == config_store_ns::stallguard_sensitivity_unset ? XY_STALL_SENSITIVITY_MIN : s; + }; + #else + auto sensitivity_fallback = [](int16_t s) { + return s; + }; + #endif + + if (axis == X_AXIS) { + stepperX.stall_sensitivity(sensitivity_fallback(crash_s.home_sensitivity[0])); + } else if (axis == Y_AXIS) { + stepperY.stall_sensitivity(sensitivity_fallback(crash_s.home_sensitivity[1])); + } +} + void Crash_s::start_sensorless_homing_per_axis(const AxisEnum axis) { if (axis < (sizeof(m_axis_is_homing) / sizeof(m_axis_is_homing[0]))) { m_axis_is_homing[axis] = true; - #if ENABLED(CORE_IS_XY) if (X_AXIS == axis || Y_AXIS == axis) { - stepperX.stall_sensitivity(crash_s.home_sensitivity[0]); - stepperY.stall_sensitivity(crash_s.home_sensitivity[1]); - } + #if ENABLED(CORE_IS_XY) + set_homing_sensitivity(X_AXIS); + set_homing_sensitivity(Y_AXIS); #else - if (X_AXIS == axis) { - stepperX.stall_sensitivity(crash_s.home_sensitivity[0]); - } else if (Y_AXIS == axis) { - stepperY.stall_sensitivity(crash_s.home_sensitivity[1]); - } + set_homing_sensitivity(axis); #endif + } } } diff --git a/lib/Marlin/Marlin/src/feature/prusa/crash_recovery.hpp b/lib/Marlin/Marlin/src/feature/prusa/crash_recovery.hpp index 6afd28a519..08ba81aca2 100644 --- a/lib/Marlin/Marlin/src/feature/prusa/crash_recovery.hpp +++ b/lib/Marlin/Marlin/src/feature/prusa/crash_recovery.hpp @@ -256,6 +256,8 @@ class Crash_s { } } + void set_homing_sensitivity(const AxisEnum axis); + /// Mayer's singleton must have part public: static Crash_s &instance(); diff --git a/lib/Marlin/Marlin/src/feature/tmc_util.cpp b/lib/Marlin/Marlin/src/feature/tmc_util.cpp index 5d28ef132e..f4f4c2b42f 100644 --- a/lib/Marlin/Marlin/src/feature/tmc_util.cpp +++ b/lib/Marlin/Marlin/src/feature/tmc_util.cpp @@ -45,6 +45,11 @@ #include "../module/stepper.h" #endif +#ifndef STALL_THRESHOLD_TMC2130 +#if !(BOARD_IS_DWARF) +#include "configuration.hpp" +#endif +#endif /** * Check for over temperature or short to ground error flags. * Report and log warning of overtemperature condition. @@ -976,8 +981,11 @@ #if HAS_DRIVER(TMC2130) bool tmc_enable_stallguard(TMC2130Stepper &st) { bool stealthchop_was_enabled = st.en_pwm_mode(); - +#ifdef STALL_THRESHOLD_TMC2130 st.TCOOLTHRS(STALL_THRESHOLD_TMC2130); +#else + st.TCOOLTHRS(get_stall_threshold()); +#endif st.en_pwm_mode(false); st.diag1_stall(true); st.sfilt(false); diff --git a/lib/Marlin/Marlin/src/gcode/calibrate/G28.cpp b/lib/Marlin/Marlin/src/gcode/calibrate/G28.cpp index 12ebe2c432..38829a47ee 100644 --- a/lib/Marlin/Marlin/src/gcode/calibrate/G28.cpp +++ b/lib/Marlin/Marlin/src/gcode/calibrate/G28.cpp @@ -36,6 +36,7 @@ static inline void MINDA_BROKEN_CABLE_DETECTION__END() {} #include "../gcode.h" #include "bsod_gui.hpp" +#include "homing_reporter.hpp" #include "../../module/endstops.h" #include "../../module/planner.h" @@ -131,8 +132,10 @@ static inline void MINDA_BROKEN_CABLE_DETECTION__END() {} }; #if ENABLED(CRASH_RECOVERY) - stepperX.stall_sensitivity(crash_s.home_sensitivity[0]); - stepperY.stall_sensitivity(crash_s.home_sensitivity[1]); + // Technically we should call end_sensorless_homing_per_axis() after + // the move, but what follows is homing anyway, so it's not needed. + crash_s.start_sensorless_homing_per_axis(X_AXIS); + crash_s.start_sensorless_homing_per_axis(Y_AXIS); #endif #endif @@ -289,7 +292,7 @@ static inline void MINDA_BROKEN_CABLE_DETECTION__END() {} static void reenable_wavetable(AxisEnum axis) { - tmc_enable_wavetable(true, axis == X_AXIS, axis == Y_AXIS, false); + tmc_enable_wavetable(axis == X_AXIS, axis == Y_AXIS, false); } /** @@ -347,8 +350,17 @@ void GcodeSuite::G28(const bool always_home_all) { bool GcodeSuite::G28_no_parser(bool always_home_all, bool O, float R, bool S, bool X, bool Y, bool Z , bool no_change OPTARG(PRECISE_HOMING_COREXY, bool precise) OPTARG(DETECT_PRINT_SHEET, bool check_sheet)) { + HomingReporter reporter; + MINDA_BROKEN_CABLE_DETECTION__BEGIN(); +#if PRINTER_IS_PRUSA_iX + // Avoid tool cleaner + if (Y) { + X = true; + } +#endif + DEBUG_SECTION(log_G28, "G28", DEBUGGING(LEVELING)); if (DEBUGGING(LEVELING)) log_machine_info(); @@ -628,7 +640,7 @@ bool GcodeSuite::G28_no_parser(bool always_home_all, bool O, float R, bool S, bo // NOTE: change of Wave Table shall normally be done only when motors are guaranteed at zero-step. Here we are far enough from the print, so if the motors do something "wild" they should make no harm. // re-enabling wavetable back will take place during homing, when we are guaranteed at stepper zero if (!failed) { - tmc_enable_wavetable(false, wavetable_off_X, wavetable_off_Y, false); + tmc_disable_wavetable(wavetable_off_X, wavetable_off_Y, false); } #if ENABLED(PRUSA_TOOLCHANGER) diff --git a/lib/Marlin/Marlin/src/module/motion.cpp b/lib/Marlin/Marlin/src/module/motion.cpp index e1a360de86..c10c0533ec 100644 --- a/lib/Marlin/Marlin/src/module/motion.cpp +++ b/lib/Marlin/Marlin/src/module/motion.cpp @@ -43,6 +43,7 @@ #else static inline void MINDA_BROKEN_CABLE_DETECTION__POST_ZHOME_0(){} #endif +#include "homing_reporter.hpp" #if IS_SCARA #include "../libs/buzzer.h" @@ -94,6 +95,10 @@ static inline void MINDA_BROKEN_CABLE_DETECTION__POST_ZHOME_0(){} #include // for has_inverted_axis +#if !(BOARD_IS_DWARF) +#include "configuration.hpp" +#endif + #define XYZ_CONSTS(T, NAME, OPT) const PROGMEM XYZval NAME##_P = { X_##OPT, Y_##OPT, Z_##OPT } XYZ_CONSTS(float, base_min_pos, MIN_POS); @@ -1853,14 +1858,14 @@ bool homeaxis(const AxisEnum axis, const feedRate_t fr_mm_s, bool invert_home_di ); #ifdef HOMING_MAX_ATTEMPTS - const float* min_diff = invert_home_dir ? axis_home_invert_min_diff : axis_home_min_diff; - const float* max_diff = invert_home_dir ? axis_home_invert_max_diff : axis_home_max_diff; + float (*min_diff)(uint8_t) = invert_home_dir ? axis_home_invert_min_diff : axis_home_min_diff; + float (*max_diff)(uint8_t) = invert_home_dir ? axis_home_invert_max_diff : axis_home_max_diff; float probe_offset; for(size_t attempt = 0;;) { #if ENABLED(PRECISE_HOMING) if ((axis == X_AXIS || axis == Y_AXIS) && !invert_home_dir) { - probe_offset = home_axis_precise(axis, axis_home_dir, can_calibrate); + probe_offset = home_axis_precise(axis, axis_home_dir, can_calibrate, fr_mm_s); attempt = HOMING_MAX_ATTEMPTS; // call home_axis_precise() just once } else @@ -1889,7 +1894,7 @@ bool homeaxis(const AxisEnum axis, const feedRate_t fr_mm_s, bool invert_home_di } // check if the offset is acceptable - bool in_range = min_diff[axis] <= probe_offset && probe_offset <= max_diff[axis]; + bool in_range = min_diff(axis) <= probe_offset && probe_offset <= max_diff(axis); metric_record_custom(&metric_home_diff, ",ax=%u,ok=%u v=%.3f,n=%u", (unsigned)axis, (unsigned)in_range, probe_offset, (unsigned)attempt); if (in_range) break; // OK offset in range @@ -1898,13 +1903,19 @@ bool homeaxis(const AxisEnum axis, const feedRate_t fr_mm_s, bool invert_home_di // not OK run out attempts switch (axis) { case X_AXIS: - homing_failed([]() { fatal_error(ErrCode::ERR_ELECTRO_HOMING_ERROR_X); }, orig_crash); + if (!HomingReporter::block_red_screen()) { + homing_failed([]() { fatal_error(ErrCode::ERR_ELECTRO_HOMING_ERROR_X); }, orig_crash); + } return false; case Y_AXIS: - homing_failed([]() { fatal_error(ErrCode::ERR_ELECTRO_HOMING_ERROR_Y); }, orig_crash); + if (!HomingReporter::block_red_screen()) { + homing_failed([]() { fatal_error(ErrCode::ERR_ELECTRO_HOMING_ERROR_Y); }, orig_crash); + } return false; default: - homing_failed([]() { fatal_error(ErrCode::ERR_ELECTRO_HOMING_ERROR_Z); }, orig_crash, true); + if (!HomingReporter::block_red_screen()) { + homing_failed([]() { fatal_error(ErrCode::ERR_ELECTRO_HOMING_ERROR_Z); }, orig_crash, true); + } return false; } } diff --git a/lib/Marlin/Marlin/src/module/motion.h b/lib/Marlin/Marlin/src/module/motion.h index 0ed8deab53..f615af0068 100644 --- a/lib/Marlin/Marlin/src/module/motion.h +++ b/lib/Marlin/Marlin/src/module/motion.h @@ -96,7 +96,6 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis); extern feedRate_t feedrate_mm_s; extern float homing_bump_divisor[]; -#define HOMING_BUMP_DIVISOR_STEP (1.03f) /** * Feedrate scaling is applied to all G0/G1, G2/G3, and G5 moves diff --git a/lib/Marlin/Marlin/src/module/prusa/homing_cart.cpp b/lib/Marlin/Marlin/src/module/prusa/homing_cart.cpp index f958f09644..9728a7e1a7 100644 --- a/lib/Marlin/Marlin/src/module/prusa/homing_cart.cpp +++ b/lib/Marlin/Marlin/src/module/prusa/homing_cart.cpp @@ -6,10 +6,13 @@ #include "Marlin.h" // for suspend_auto_report #include "../motion.h" #include "../stepper.h" +#include "feature/prusa/crash_recovery.hpp" +#include "configuration.hpp" -static const float homing_bump_divisor_dflt[] PROGMEM = HOMING_BUMP_DIVISOR; -static const float homing_bump_divisor_max[] PROGMEM = HOMING_BUMP_DIVISOR_MAX; -static const float homing_bump_divisor_min[] PROGMEM = HOMING_BUMP_DIVISOR_MIN; +inline constexpr float HOMING_BUMP_DIVISOR_STEP = 1.03f; +inline constexpr float homing_bump_divisor_dflt[] = HOMING_BUMP_DIVISOR; +inline constexpr float homing_bump_divisor_max[] = HOMING_BUMP_DIVISOR_MAX; +inline constexpr float homing_bump_divisor_min[] = HOMING_BUMP_DIVISOR_MIN; /** * Turns automatic reports off until destructor is called. @@ -73,11 +76,11 @@ float calibrated_home_offset(const AxisEnum axis) { switch (axis) { case X_AXIS: { return ((X_HOME_DIR < 0 ? X_HOME_GAP : -X_HOME_GAP) - - ((((INVERT_X_DIR) ? -1.f : 1.f) * to_calibrated(cal, stepperX.MSCNT())) / (steps_per_unit[X_AXIS] * (256 / X_MICROSTEPS)))); + - ((((INVERT_X_DIR) ? -1.f : 1.f) * to_calibrated(cal, stepperX.MSCNT())) / (steps_per_unit[X_AXIS] * (256 / get_microsteps_x())))); } case Y_AXIS: { return ((Y_HOME_DIR < 0 ? Y_HOME_GAP : -Y_HOME_GAP) - - ((((INVERT_Y_DIR) ? -1.f : 1.f) * to_calibrated(cal, stepperY.MSCNT())) / (steps_per_unit[Y_AXIS] * (256 / Y_MICROSTEPS)))); + - ((((INVERT_Y_DIR) ? -1.f : 1.f) * to_calibrated(cal, stepperY.MSCNT())) / (steps_per_unit[Y_AXIS] * (256 / get_microsteps_y())))); } default:; } @@ -89,15 +92,17 @@ float calibrated_home_offset(const AxisEnum axis) { * * \returns offset from calibrated point -512 .. +512 */ -static int32_t home_and_get_calibration_offset(AxisEnum axis, int axis_home_dir, float &probe_offset, bool store_samples) { +static int32_t home_and_get_calibration_offset(AxisEnum axis, int axis_home_dir, float &probe_offset, bool store_samples, float fr_mm_s = 0) { int32_t calibration_offset = 0; bool calibrated = false; bool break_loop = false; + fr_mm_s = fr_mm_s != 0.0f ? fr_mm_s : homing_feedrate_mm_s[axis]; + do { - const int32_t mscnt = home_and_get_mscnt(axis, axis_home_dir, homing_feedrate_mm_s[axis] / homing_bump_divisor[axis], probe_offset); + const int32_t mscnt = home_and_get_mscnt(axis, axis_home_dir, fr_mm_s / homing_bump_divisor[axis], probe_offset); - if ((probe_offset >= axis_home_min_diff[axis]) - && (probe_offset <= axis_home_max_diff[axis]) + if ((probe_offset >= axis_home_min_diff(axis)) + && (probe_offset <= axis_home_max_diff(axis)) && store_samples) { PersistentStorage::pushHomeSample(mscnt, 255, axis); // todo board_temp } else { @@ -109,16 +114,16 @@ static int32_t home_and_get_calibration_offset(AxisEnum axis, int axis_home_dir, calibration_offset = 0; SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Precise homing axis: ", axis); - SERIAL_ECHOPAIR(" probe_offset: ", probe_offset); - SERIAL_ECHOPAIR(" HB divisor: ", homing_bump_divisor[axis]); + SERIAL_ECHOPAIR(" homing probe offset: ", probe_offset); + SERIAL_ECHOPAIR(" divisor: ", homing_bump_divisor[axis]); SERIAL_ECHOPAIR(" mscnt: ", mscnt); - SERIAL_ECHOPAIR(" ipos: ", stepper.position_from_startup(axis)); if (calibrated) { - SERIAL_ECHOLNPAIR(" Home position diff: ", calibration_offset); + SERIAL_ECHOLNPAIR(" calibration offset: ", calibration_offset); } else { ui.status_printf_P(0, "Calibrating %c axis", axis_codes[axis]); - SERIAL_ECHOLN(" Not yet calibrated."); + // I _could_ use SERIAL_ECHOLN(), but that somehow cuts off the end + // of the printed string. Very nice. + SERIAL_ECHOLNPAIR(" Not yet", " calibrated."); } } while (store_samples && !calibrated && !break_loop); @@ -128,8 +133,8 @@ static int32_t home_and_get_calibration_offset(AxisEnum axis, int axis_home_dir, static void load_divisor_from_eeprom() { for (int axis = 0; axis < XY; axis++) { - const float max = pgm_read_float(&homing_bump_divisor_max[axis]); - const float min = pgm_read_float(&homing_bump_divisor_min[axis]); + const float max = homing_bump_divisor_max[axis]; + const float min = homing_bump_divisor_min[axis]; const float hbd = homing_bump_divisor[axis]; if (hbd >= min && hbd <= max) { continue; @@ -139,17 +144,16 @@ static void load_divisor_from_eeprom() { if (loaded >= min && loaded <= max) { homing_bump_divisor[axis] = loaded; } else { - homing_bump_divisor[axis] = pgm_read_float(&homing_bump_divisor_dflt[axis]); + homing_bump_divisor[axis] = homing_bump_divisor_dflt[axis]; } } } static void homing_failed_update_divisor(AxisEnum axis) { homing_bump_divisor[axis] *= HOMING_BUMP_DIVISOR_STEP; - const float max = pgm_read_float(&homing_bump_divisor_max[axis]); - const float min = pgm_read_float(&homing_bump_divisor_min[axis]); + const float max = homing_bump_divisor_max[axis]; + const float min = homing_bump_divisor_min[axis]; const float hbd = homing_bump_divisor[axis]; - __attribute__((unused)) const float dflt = pgm_read_float(&homing_bump_divisor_dflt[axis]); if (hbd > max || /* shouldnt happen, just to make sure */ hbd < min) { homing_bump_divisor[axis] = min; } @@ -165,6 +169,99 @@ static void save_divisor_to_eeprom(int try_nr, AxisEnum axis) { } } +#if PRINTER_IS_PRUSA_MK4 +inline constexpr uint8_t HOMING_SENSITIVITY_CALIBRATION_TRIES = 4; + +static void store_homing_sensitivity(AxisEnum axis, int16_t value) { + switch (axis) { + case X_AXIS: + config_store().homing_sens_x.set(value); + break; + case Y_AXIS: + config_store().homing_sens_y.set(value); + break; + default: + assert(false && "invalid axis index"); + } +} + +class SensitivityCalibration { + struct AvgData { + float probe_offset_avg { 0.0 }; + uint8_t n { 0 }; + }; + + AxisEnum axis; + std::array avgs; + int16_t current_sensitivity { XY_STALL_SENSITIVITY_MIN }; // start at the lowest sensitivity + bool calibrated { false }; + + size_t s2i(int16_t sensitivity) { + return sensitivity - XY_STALL_SENSITIVITY_MIN; + } + + int16_t i2s(size_t index) { + return index + XY_STALL_SENSITIVITY_MIN; + } + +public: + SensitivityCalibration(AxisEnum axis, bool force_recalibration = false) + : axis(axis) { + SERIAL_ECHO_START(); + SERIAL_ECHO("Homing sensitivity: "); + if (crash_s.home_sensitivity[axis] != config_store_ns::stallguard_sensitivity_unset) { + if (force_recalibration) { + SERIAL_ECHOLNPAIR("forcing recalibration, sensitivity ", current_sensitivity); + crash_s.home_sensitivity[axis] = current_sensitivity; + } else { + SERIAL_ECHOLNPAIR("already calibrated to ", crash_s.home_sensitivity[axis]); + calibrated = true; + } + } else { + SERIAL_ECHOLNPAIR("starting calibration at sensitivity ", current_sensitivity); + crash_s.home_sensitivity[axis] = current_sensitivity; + } + } + + void update_probe_offset_avg(float probe_offset) { + auto &data = avgs[s2i(current_sensitivity)]; + + data.probe_offset_avg = data.probe_offset_avg + (abs(probe_offset) - data.probe_offset_avg) / ++data.n; + + // If the probe offset is off by more than 6mm after a couple of tries, + // it's way too sensitive, move on to next sensitivity early + if ((data.n >= HOMING_SENSITIVITY_CALIBRATION_TRIES / 2 && data.probe_offset_avg > 6) + || data.n >= HOMING_SENSITIVITY_CALIBRATION_TRIES) { + current_sensitivity++; // move on to the next sensitivity + crash_s.home_sensitivity[axis] = current_sensitivity; + + if (current_sensitivity > XY_STALL_SENSITIVITY_MAX) { + auto it = std::min_element( + avgs.begin(), + avgs.end(), + [](const AvgData &a, const AvgData &b) { return a.probe_offset_avg < b.probe_offset_avg; }); + + current_sensitivity = i2s(it - avgs.begin()); + crash_s.home_sensitivity[axis] = current_sensitivity; + + SERIAL_ECHO_START(); + SERIAL_ECHOPAIR("Homing sensitivity: calibrated to ", current_sensitivity); + SERIAL_ECHOLNPAIR(" of probe offset avg: ", it->probe_offset_avg); + store_homing_sensitivity(axis, current_sensitivity); + calibrated = true; + } else { + SERIAL_ECHO_START(); + SERIAL_ECHOLNPAIR("Homing sensitivity: calibrating at sensitivity ", current_sensitivity); + } + } + } + + bool is_calibrated() { return calibrated; } + + int8_t get_current_sensitivity() { return current_sensitivity; } +}; +#endif + /** * \brief Home and decide if position of both probes is close enough to calibrated home position * @@ -176,18 +273,45 @@ static void save_divisor_to_eeprom(int try_nr, AxisEnum axis) { * \param can_calibrate Can be calibrated home position updated? * \return Distance between two probes in mm. */ -float home_axis_precise(AxisEnum axis, int axis_home_dir, bool can_calibrate) { +float home_axis_precise(AxisEnum axis, int axis_home_dir, bool can_calibrate, float fr_mm_s) { const int tries = can_calibrate ? PRECISE_HOMING_TRIES : (3 * PRECISE_HOMING_TRIES); - const int accept_perfect_only_tries = can_calibrate ? (PRECISE_HOMING_TRIES / 3) : 0; + int accept_perfect_only_tries = can_calibrate ? 3 : 3 * 3; constexpr int perfect_offset = 96; constexpr int acceptable_offset = 288; float probe_offset; bool first_acceptable = false; + [[maybe_unused]] bool done_sens_calib_reset = false; load_divisor_from_eeprom(); for (int try_nr = 0; try_nr < tries; ++try_nr) { - const int32_t calibration_offset = home_and_get_calibration_offset(axis, axis_home_dir, probe_offset, can_calibrate); + SERIAL_ECHO_START(); + SERIAL_ECHOPAIR("== Precise Homing axis ", axis_codes[axis]); + SERIAL_ECHOPAIR(" try ", try_nr); + SERIAL_ECHOLN(" =="); + +#if PRINTER_IS_PRUSA_MK4 + // If homing is failing, try to recalibrate sensitivity. We do this + // after we couldn't home perfectly, and increase the perfect only + // tries so that we still try to home perfectly after recalibrating + // the sensitivity. + bool reset_sens_calibration = false; + if (can_calibrate && try_nr >= accept_perfect_only_tries && !done_sens_calib_reset) { + reset_sens_calibration = true; + done_sens_calib_reset = true; + accept_perfect_only_tries *= 2; + } + + SensitivityCalibration sens_calibration { axis, reset_sens_calibration }; + + while (can_calibrate && !sens_calibration.is_calibrated()) { + ui.status_printf_P(0, "Recalibrating %c axis. Printer may vibrate and be noisier.", axis_codes[axis]); + home_and_get_calibration_offset(axis, axis_home_dir, probe_offset, false, fr_mm_s); + sens_calibration.update_probe_offset_avg(probe_offset); + } +#endif + + const int32_t calibration_offset = home_and_get_calibration_offset(axis, axis_home_dir, probe_offset, can_calibrate, fr_mm_s); if (planner.draining()) { // homing intentionally aborted, do not retry break; @@ -196,8 +320,8 @@ float home_axis_precise(AxisEnum axis, int axis_home_dir, bool can_calibrate) { SERIAL_ECHO_START(); SERIAL_ECHO("Probe classified as "); - if ((probe_offset < axis_home_min_diff[axis]) - || (probe_offset > axis_home_max_diff[axis])) { + if ((probe_offset < axis_home_min_diff(axis)) + || (probe_offset > axis_home_max_diff(axis))) { SERIAL_ECHOLN("failed."); ui.status_printf_P(0, "%c axis homing failed, retrying", axis_codes[axis]); homing_failed_update_divisor(axis); diff --git a/lib/Marlin/Marlin/src/module/prusa/homing_cart.hpp b/lib/Marlin/Marlin/src/module/prusa/homing_cart.hpp index 54a31114f2..2d0b79d989 100644 --- a/lib/Marlin/Marlin/src/module/prusa/homing_cart.hpp +++ b/lib/Marlin/Marlin/src/module/prusa/homing_cart.hpp @@ -16,4 +16,4 @@ float calibrated_home_offset(const AxisEnum axis); * calibration should be disabled for crash recovery, power loss recovery etc. * \return probe offset */ -float home_axis_precise(AxisEnum axis, int axis_home_dir, bool can_calibrate = true); +float home_axis_precise(AxisEnum axis, int axis_home_dir, bool can_calibrate = true, float fr_mm_s = 0); diff --git a/lib/Marlin/Marlin/src/module/prusa/homing_utils.cpp b/lib/Marlin/Marlin/src/module/prusa/homing_utils.cpp index 6b4fc9e399..8d938c3aa6 100644 --- a/lib/Marlin/Marlin/src/module/prusa/homing_utils.cpp +++ b/lib/Marlin/Marlin/src/module/prusa/homing_utils.cpp @@ -7,6 +7,7 @@ #include "../../feature/prusa/crash_recovery.hpp" #include "../../module/endstops.h" #include "../stepper.h" +#include #if HAS_WORKSPACE_OFFSET static workspace_xyz_t disable_workspace(bool do_x, bool do_y, bool do_z) { @@ -108,9 +109,9 @@ el_current_xyz_t reset_current_if(bool condition) { if (!condition) return curr; - stepperX.rms_current(X_CURRENT); - stepperY.rms_current(Y_CURRENT); - stepperZ.rms_current(Z_CURRENT); + stepperX.rms_current(get_default_rms_current_ma_x()); + stepperY.rms_current(get_default_rms_current_ma_y()); + stepperZ.rms_current(get_default_rms_current_ma_z()); return curr; } diff --git a/lib/Marlin/Marlin/src/module/stepper/trinamic.cpp b/lib/Marlin/Marlin/src/module/stepper/trinamic.cpp index 5694909104..cb7f4cca78 100644 --- a/lib/Marlin/Marlin/src/module/stepper/trinamic.cpp +++ b/lib/Marlin/Marlin/src/module/stepper/trinamic.cpp @@ -40,11 +40,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; -#if DISABLED(USE_PRUSA_EEPROM_AS_SOURCE_OF_DEFAULT_VALUES) #define _TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX]) -#else -#define _TMC_INIT(ST, STEALTH_INDEX) tmc_init(stepper##ST, config_store().axis_rms_current_ma_##ST##_.get(), config_store().axis_microsteps_##ST##_.get(), ST##_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_INDEX]) -#endif // IC = TMC model number // ST = Stepper object letter @@ -144,41 +140,35 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; st.stored.stealthChop_enabled = stealth; PWMCONF_t pwmconf{0}; pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk - #if defined(HAS_LDO_400_STEP) - if ('X' == AXIS_LETTER) - { - pwmconf.pwm_autoscale = false; - //370 mA RMS/1phase at 60 mm/min and 5500 mm/min LDO 400 step - pwmconf.pwm_grad = 0x0C; - pwmconf.pwm_ampl = 0x12; - } - else if ('Y' == AXIS_LETTER) - { - pwmconf.pwm_autoscale = false; - //470 mA RMS/1phase at 60 mm/min and 5500 mm/min LDO 400 step - pwmconf.pwm_grad = 0x0D; - pwmconf.pwm_ampl = 0x16; - } - #else + +#if ENABLED(USE_PRUSA_EEPROM_AS_SOURCE_OF_DEFAULT_VALUES) + const bool motors_400_step = config_store().xy_motors_400_step.get(); +#else + constexpr bool motors_400_step = false; +#endif + if ('X' == AXIS_LETTER) { pwmconf.pwm_autoscale = false; - //LDO 200 step + //LDO 400 step (MK4) + //370 mA RMS/1phase at 60 mm/min and 5500 mm/min + //LDO 200 step (MK3.9) //258 mA RMS/1phase at 60 mm/min, 332 at 600, 355 at 1000, 372 at 2000, 369 at 3000, 352 at 4000, //343 at 5000, 323 at 6000, 314 at 7000, 306 at 8000, 296 at 9000, 250 at 10000, 193 at 11000 - pwmconf.pwm_grad = 0x2E; - pwmconf.pwm_ampl = 0x1F; + pwmconf.pwm_grad = motors_400_step ? 0x0C : 0x2E; + pwmconf.pwm_ampl = motors_400_step ? 0x12 : 0x1F; } else if ('Y' == AXIS_LETTER) { pwmconf.pwm_autoscale = false; - //LDO 200 step + //LDO 400 step (MK4) + //470 mA RMS/1phase at 60 mm/min and 5500 mm/min LDO 400 step + //LDO 200 step (MK3.9) //255 mA RMS/1phase at 60 mm/min, 330mA at 600, 362 at 1000, 400 at 2000, 383 at 3000, //386 at 4000, 369 at 5000, 355 at 6000, 345 at 7000, 345 at 8000, 322 at 9000, 250 at 10000 - pwmconf.pwm_grad = 0x30; - pwmconf.pwm_ampl = 0x1F; + pwmconf.pwm_grad = motors_400_step ? 0x0D : 0x30; + pwmconf.pwm_ampl = motors_400_step ? 0x16 : 0x1F; } - #endif //HAS_LDO_400_STEP else if ('E' == AXIS_LETTER) { pwmconf.pwm_autoscale = false; @@ -712,19 +702,31 @@ void reset_trinamic_drivers() { }; #if AXIS_IS_TMC(X) +#if DISABLED(USE_PRUSA_EEPROM_AS_SOURCE_OF_DEFAULT_VALUES) _TMC_INIT(X, STEALTH_AXIS_XY); +#else +tmc_init(stepperX, get_default_rms_current_ma_x(), get_microsteps_x(), X_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_AXIS_XY]); +#endif #endif #if AXIS_IS_TMC(X2) _TMC_INIT(X2, STEALTH_AXIS_XY); #endif #if AXIS_IS_TMC(Y) +#if DISABLED(USE_PRUSA_EEPROM_AS_SOURCE_OF_DEFAULT_VALUES) _TMC_INIT(Y, STEALTH_AXIS_XY); +#else +tmc_init(stepperY, get_default_rms_current_ma_y(), get_microsteps_y(), Y_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_AXIS_XY]); +#endif #endif #if AXIS_IS_TMC(Y2) _TMC_INIT(Y2, STEALTH_AXIS_XY); #endif #if AXIS_IS_TMC(Z) +#if DISABLED(USE_PRUSA_EEPROM_AS_SOURCE_OF_DEFAULT_VALUES) _TMC_INIT(Z, STEALTH_AXIS_Z); +#else +tmc_init(stepperZ, get_default_rms_current_ma_z(), get_microsteps_z(), Z_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_AXIS_Z]); +#endif #endif #if AXIS_IS_TMC(Z2) _TMC_INIT(Z2, STEALTH_AXIS_Z); @@ -733,7 +735,11 @@ void reset_trinamic_drivers() { _TMC_INIT(Z3, STEALTH_AXIS_Z); #endif #if AXIS_IS_TMC(E0) +#if DISABLED(USE_PRUSA_EEPROM_AS_SOURCE_OF_DEFAULT_VALUES) _TMC_INIT(E0, STEALTH_AXIS_E); +#else +tmc_init(stepperE0, get_default_rms_current_ma_e(), get_microsteps_e(), E0_HYBRID_THRESHOLD, stealthchop_by_axis[STEALTH_AXIS_E]); +#endif #endif #if AXIS_IS_TMC(E1) _TMC_INIT(E1, STEALTH_AXIS_E); diff --git a/lib/WUI/CMakeLists.txt b/lib/WUI/CMakeLists.txt index cb19ab5b6d..7dc4930cd0 100644 --- a/lib/WUI/CMakeLists.txt +++ b/lib/WUI/CMakeLists.txt @@ -30,7 +30,6 @@ target_sources( nhttp/send_file.cpp nhttp/send_json.cpp nhttp/server.cpp - nhttp/splice.cpp nhttp/static_mem.cpp nhttp/status_page.cpp nhttp/status_renderer.cpp @@ -54,6 +53,11 @@ if(NETWORKING_BENCHMARK_ENABLED) target_compile_definitions(WUI INTERFACE NETWORKING_BENCHMARK_ENABLED) endif() +if(USE_ASYNCIO) + target_sources(WUI INTERFACE nhttp/splice.cpp) + target_compile_definitions(WUI INTERFACE USE_ASYNCIO) +endif() + file(GLOB AUTOMATA_GENERATORS ${PROJECT_ROOT_DIR}/utils/gen-automata/*.py) add_custom_command( diff --git a/lib/WUI/nhttp/gcode_upload.cpp b/lib/WUI/nhttp/gcode_upload.cpp index 5a14e5e296..ad419366d0 100644 --- a/lib/WUI/nhttp/gcode_upload.cpp +++ b/lib/WUI/nhttp/gcode_upload.cpp @@ -2,7 +2,9 @@ #include "upload_state.h" #include "file_info.h" #include "handler.h" -#include "splice.h" +#if USE_ASYNCIO + #include "splice.h" +#endif #include "../../src/common/filename_type.hpp" #include "../wui_api.h" @@ -29,15 +31,17 @@ using handler::RequestParser; using handler::StatusPage; using handler::Step; using http::Status; +#if USE_ASYNCIO using splice::Result; using std::array; +using std::optional; +#endif using std::get; using std::get_if; using std::holds_alternative; using std::make_tuple; using std::move; using std::nullopt; -using std::optional; using std::string_view; using transfers::ChangedPath; using transfers::CHECK_FILENAME; @@ -59,7 +63,8 @@ GcodeUpload::GcodeUpload(UploadParams &&uploader, Monitor::Slot &&slot, bool jso , json_errors(json_errors) , cleanup_temp_file(true) , tmp_upload_file(move(file)) - , file_idx(upload_idx) { + , file_idx(upload_idx) + , filename_checked(false) { } GcodeUpload::GcodeUpload(GcodeUpload &&other) @@ -70,7 +75,8 @@ GcodeUpload::GcodeUpload(GcodeUpload &&other) , json_errors(other.json_errors) , cleanup_temp_file(other.cleanup_temp_file) , tmp_upload_file(move(other.tmp_upload_file)) - , file_idx(other.file_idx) { + , file_idx(other.file_idx) + , filename_checked(other.filename_checked) { // The ownership of the temp file is passed to the new instance. other.cleanup_temp_file = false; } @@ -87,6 +93,7 @@ GcodeUpload &GcodeUpload::operator=(GcodeUpload &&other) { tmp_upload_file = move(other.tmp_upload_file); file_idx = other.file_idx; + filename_checked = other.filename_checked; return *this; } @@ -303,7 +310,7 @@ namespace { return f(fn); } } - +#if USE_ASYNCIO class PutTransfer final : public splice::Transfer { public: GcodeUpload::UploadedNotify *uploaded_notify = nullptr; @@ -389,6 +396,7 @@ namespace { // TODO: A better place to have this? Or dynamic allocation? Share with the connect uploader? PutTransfer put_transfer; +#endif } // namespace UploadHooks::Result GcodeUpload::check_filename(const char *filename) const { @@ -466,10 +474,12 @@ UploadHooks::Result GcodeUpload::finish(const char *final_filename, bool start_p }); } -Step GcodeUpload::step(string_view, const size_t read, PutParams &putParams) { +Step GcodeUpload::step(string_view input, const size_t read, PutParams &putParams) { // remove the "/usb/" prefix const char *filename = putParams.filepath.data() + USB_MOUNT_POINT_LENGTH; +#if USE_ASYNCIO + static_cast(input); auto filename_error = check_filename(filename); if (std::get<0>(filename_error) != Status::Ok) return { read, 0, StatusPage(std::get<0>(filename_error), StatusPage::CloseHandling::ErrorClose, json_errors, nullopt, std::get<1>(filename_error)) }; @@ -484,6 +494,35 @@ Step GcodeUpload::step(string_view, const size_t read, PutParams &putParams) { put_transfer.file_idx = file_idx; cleanup_temp_file = false; return { 0, 0, make_tuple(&put_transfer, size_rest) }; +#else + // bit of a hack, would make more sense checking this in GcodeUpload::start, + // but that is a static method and we need check_filename to be virtual, so + // it can be used inside UploadState as a function of UploadHooks. + if (!filename_checked) { + auto filename_error = check_filename(filename); + if (std::get<0>(filename_error) != Status::Ok) + return { read, 0, StatusPage(std::get<0>(filename_error), StatusPage::CloseHandling::ErrorClose, json_errors, nullopt, std::get<1>(filename_error)) }; + filename_checked = true; + } + + auto error = data(input.substr(0, read)); + if (std::get<0>(error) != Status::Ok) { + return { read, 0, StatusPage(std::get<0>(error), StatusPage::CloseHandling::ErrorClose, json_errors, nullopt, std::get<1>(error)) }; + } + + monitor_slot.progress(read); + + size_rest -= read; + if (size_rest == 0) { + auto finish_error = finish(filename, putParams.print_after_upload); + if (std::get<0>(finish_error) != Status::Ok) + return { read, 0, StatusPage(std::get<0>(finish_error), StatusPage::CloseHandling::ErrorClose, json_errors, nullopt, std::get<1>(finish_error)) }; + + return { read, 0, FileInfo(putParams.filepath.data(), false, json_errors, true, FileInfo::ReqMethod::Get, FileInfo::APIVersion::v1, std::nullopt) }; + } + + return { read, 0, Continue() }; +#endif } } // namespace nhttp::printer diff --git a/lib/WUI/nhttp/gcode_upload.h b/lib/WUI/nhttp/gcode_upload.h index dc29577750..50e7e0667b 100644 --- a/lib/WUI/nhttp/gcode_upload.h +++ b/lib/WUI/nhttp/gcode_upload.h @@ -57,6 +57,7 @@ namespace printer { unique_file_ptr tmp_upload_file; // A way how to reconstruct the name of the temporary file. size_t file_idx; + bool filename_checked; virtual Result data(std::string_view data) override; virtual Result finish(const char *final_filename, bool start_print) override; diff --git a/lib/WUI/nhttp/handler.h b/lib/WUI/nhttp/handler.h index b6eb2632d4..e0be5ac8bd 100644 --- a/lib/WUI/nhttp/handler.h +++ b/lib/WUI/nhttp/handler.h @@ -160,8 +160,10 @@ namespace handler { // TODO: Some generic generators/consumers Terminating>; +#if USE_ASYNCIO // A transfer + the amount of data to transfer. using TransferExpected = std::tuple; +#endif /** * \brief Instruction on what to do next, coming from a handler. @@ -170,8 +172,12 @@ namespace handler { */ using NextInstruction = std::variant< ConnectionState, - Continue, - TransferExpected>; + Continue +#if USE_ASYNCIO + , + TransferExpected +#endif + >; /** * \brief The full response of the handler's step method. diff --git a/lib/WUI/nhttp/server.cpp b/lib/WUI/nhttp/server.cpp index cff5211a3a..47ea598850 100644 --- a/lib/WUI/nhttp/server.cpp +++ b/lib/WUI/nhttp/server.cpp @@ -1,5 +1,7 @@ #include "server.h" -#include "splice.h" +#if USE_ASYNCIO + #include "splice.h" +#endif #include #include @@ -104,7 +106,9 @@ void Server::ConnectionSlot::release() { release_buffer(); client_closed = false; Slot::release(); +#if USE_ASYNCIO server->try_send_transfer_response(this); +#endif } bool Server::ConnectionSlot::is_empty() const { @@ -162,6 +166,7 @@ void Server::ConnectionSlot::step(string_view input, uint8_t *output, size_t out if (holds_alternative(s.next)) { state = get(std::move(s.next)); +#if USE_ASYNCIO } else if (holds_alternative(s.next)) { TransferSlot *dest = &server->transfer_slot; // We are asked to perform a transfer from socket -> file. For that we: @@ -208,6 +213,7 @@ void Server::ConnectionSlot::step(string_view input, uint8_t *output, size_t out } release(); +#endif } } @@ -392,7 +398,9 @@ Server::Server(const ServerDefs &defs) for (auto &slot : active_slots) { slot.server = this; } +#if USE_ASYNCIO transfer_slot.server = this; +#endif } err_t Server::accept_wrap(void *me, struct altcp_pcb *new_conn, err_t err) { @@ -617,7 +625,11 @@ bool Server::is_active_slot(void *slot) { } BaseSlot *s = static_cast(slot); - return (dynamic_cast(s) != nullptr) || (dynamic_cast(s) != nullptr); + return (dynamic_cast(s) != nullptr) +#if USE_ASYNCIO + || (dynamic_cast(s) != nullptr) +#endif + ; } void Server::activity(altcp_pcb *conn, BaseSlot *slot) { @@ -677,6 +689,7 @@ void Server::stop() { // Note: Letting the rest of the connections to live on! } +#if USE_ASYNCIO void Server::TransferSlot::release() { expected_data = 0; reqs_pending = 0; @@ -860,5 +873,6 @@ void Server::TransferSlot::make_response(ConnectionSlot *slot) { void Server::transfer_done(std::optional> res) { transfer_slot.done(res); } +#endif } // namespace nhttp diff --git a/lib/WUI/nhttp/server.h b/lib/WUI/nhttp/server.h index e6d259c086..27cd670eba 100644 --- a/lib/WUI/nhttp/server.h +++ b/lib/WUI/nhttp/server.h @@ -271,6 +271,7 @@ class Server { */ uint8_t last_active_slot = 0; +#if USE_ASYNCIO class TransferSlot : public Slot { private: friend class ConnectionSlot; @@ -300,6 +301,7 @@ class Server { }; TransferSlot transfer_slot; +#endif /* * There's an activity on the given connection. Reset appropriate timeouts. @@ -402,6 +404,7 @@ class Server { return defs.get_password(); } +#if USE_ASYNCIO // TODO: This is ... meh. // // The write requests to the IO thread report a write of this size @@ -416,6 +419,7 @@ class Server { // Similar (the Done) request. void transfer_done(std::optional> res); +#endif }; } // namespace nhttp diff --git a/lib/WUI/wui.cpp b/lib/WUI/wui.cpp index 40ad50ba05..5747741267 100644 --- a/lib/WUI/wui.cpp +++ b/lib/WUI/wui.cpp @@ -27,6 +27,7 @@ #include #include "http_lifetime.h" #include "main.h" +#include "tasks.hpp" #include "netdev.h" @@ -327,6 +328,7 @@ class NetworkState { // // Q: Do other threads, like connect, need to wait for this? tcpip_init(tcpip_init_done_raw, this); + TaskDeps::provide(TaskDeps::Dependency::lwip_initialized); prusalink_password_init(); diff --git a/src/buddy/main.cpp b/src/buddy/main.cpp index 757ec7eb5c..237c4e39ec 100644 --- a/src/buddy/main.cpp +++ b/src/buddy/main.cpp @@ -57,7 +57,9 @@ #include