Skip to content

Commit

Permalink
Release v5.1.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Prusa Research authored and dragomirecky committed Nov 15, 2023
1 parent 7a6a46a commit 28dd066
Show file tree
Hide file tree
Showing 2,129 changed files with 141,573 additions and 47,097 deletions.
39 changes: 31 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,24 @@ if(BOARD MATCHES ".*BUDDY" AND HAS_PUPPIES_BOOTLOADER)
endif()
endif()

# Unittests
if(NOT CMAKE_CROSSCOMPILING)
option(UNITTESTS_ENABLE "Enable building of unittest" ON)
if(UNITTESTS_ENABLE)
enable_testing()
add_subdirectory(tests)
endif()
endif()

# std::rand/random
if(BOARD MATCHES ".*BUDDY")
set(ENABLE_HW_STD_RAND TRUE)
set(RANDOM_CPP random_hw.cpp)
else()
set(ENABLE_HW_STD_RAND FALSE)
set(RANDOM_CPP random_sw.cpp)
endif()

#
# Buddy firmware
#
Expand All @@ -470,6 +488,15 @@ target_compile_options(
-Wdouble-promotion
)

if(ENABLE_HW_STD_RAND)
# Wrap rand and replace the implementation with one using HW RNG
target_link_options(firmware PUBLIC -Wl,--wrap=rand)

# Wrap srand, do not implement the wrapper -> throws error when referenced in the code. rand()
# uses HW RNG now, so it cannot be seeded
target_link_options(firmware PUBLIC -Wl,--wrap=srand)
endif()

# Appending fw descriptor (with calculated fingerprint) to the ELF
if(BOARD STREQUAL "DWARF" OR BOARD STREQUAL "MODULARBED")
add_custom_command(
Expand Down Expand Up @@ -542,6 +569,8 @@ if(GENERATE_BBF)
"${PRINTER_TYPE}"
PRINTER_VERSION
"${PRINTER_VERSION}"
PRINTER_SUBVERSION
"${PRINTER_SUBVERSION}"
SIGNING_KEY
"${SIGNING_KEY}"
BBF_VERSION
Expand All @@ -563,6 +592,8 @@ if(GENERATE_BBF)
"${PRINTER_TYPE}"
PRINTER_VERSION
"${PRINTER_VERSION}"
PRINTER_SUBVERSION
"${PRINTER_SUBVERSION}"
SIGNING_KEY
"${SIGNING_KEY}"
BBF_VERSION
Expand Down Expand Up @@ -664,11 +695,3 @@ set_property(
FW_VERSION_SUFFIX=${PROJECT_VERSION_SUFFIX}
FW_VERSION_SUFFIX_SHORT=${PROJECT_VERSION_SUFFIX_SHORT}
)

if(NOT CMAKE_CROSSCOMPILING)
option(UNITTESTS_ENABLE "Enable building of unittest" ON)
if(UNITTESTS_ENABLE)
enable_testing()
add_subdirectory(tests)
endif()
endif()
26 changes: 13 additions & 13 deletions ProjectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ set(PRINTERS_WITH_PRECISE_HOMING_COREXY "XL")
# private MINI would not fit to 1MB so it has disabled selftest set(PRINTERS_WITH_SELFTEST "MINI"
# "MK4")
set(PRINTERS_WITH_SELFTEST "MK4" "MK3.5" "XL" "iX" "MINI")
set(PRINTERS_WITH_SELFTEST_SNAKE "XL")
set(PRINTERS_WITH_SELFTEST_SNAKE "XL" "MK4")
set(PRINTERS_WITH_HUMAN_INTERACTIONS "MINI" "MK4" "MK3.5" "XL")
set(PRINTERS_WITH_LOADCELL "MK4" "iX" "XL")
set(PRINTERS_WITH_HEATBREAK_TEMP "MK4" "iX" "XL")
Expand All @@ -263,7 +263,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 "MK4" "XL")
set(PRINTERS_WITH_TRANSLATIONS "MK4" "MK3.5" "XL")
set(PRINTERS_WITH_LOVE_BOARD "MK4" "iX")
set(PRINTERS_WITH_MMU2 "MK4" "MK3.5")

Expand All @@ -274,7 +274,6 @@ set(PRINTERS_WITH_GUI_W240H320 "MINI")
set(PRINTERS_WITH_LEDS "MK4" "MK3.5" "XL" "iX")
# disable serial printing for MINI to save flash
set(PRINTERS_WITH_SERIAL_PRINTING "MK4" "MK3.5" "XL" "iX" "MINI")
set(PRINTERS_WITH_CONTROL_MENU "MK4" "MK3.5" "XL" "MINI")

# Set printer board
set(BOARDS_WITH_ADVANCED_POWER "XBUDDY" "XLBUDDY" "DWARF")
Expand Down Expand Up @@ -533,7 +532,17 @@ else()
set(HAS_PUPPIES_BOOTLOADER NO)
endif()
define_boolean_option(HAS_PUPPIES_BOOTLOADER ${HAS_PUPPIES_BOOTLOADER})
define_boolean_option(PUPPY_FLASH_FW ${HAS_PUPPIES_BOOTLOADER})

set(PUPPY_SKIP_FLASH_FW
"OFF"
CACHE BOOL "Disable flashing puppies to debug puppy with bootloader."
)
if(${HAS_PUPPIES_BOOTLOADER} AND NOT ${PUPPY_SKIP_FLASH_FW})
set(PUPPY_FLASH_FW YES)
else()
set(PUPPY_FLASH_FW NO)
endif()
define_boolean_option(PUPPY_FLASH_FW ${PUPPY_FLASH_FW})

if(${PRINTER} IN_LIST PRINTERS_WITH_TOOLCHANGER)
set(HAS_TOOLCHANGER YES)
Expand All @@ -542,13 +551,6 @@ else()
endif()
define_boolean_option(HAS_TOOLCHANGER ${HAS_TOOLCHANGER})

if(${PRINTER} IN_LIST PRINTERS_WITH_CONTROL_MENU)
set(HAS_CONTROL_MENU YES)
else()
set(HAS_CONTROL_MENU NO)
endif()
define_boolean_option(HAS_CONTROL_MENU ${HAS_CONTROL_MENU})

if(${PRINTER} IN_LIST PRINTERS_WITH_SELFTEST_SNAKE)
set(HAS_SELFTEST_SNAKE YES)
else()
Expand Down Expand Up @@ -582,8 +584,6 @@ else()
define_boolean_option(NETWORKING_BENCHMARK_ENABLED NO)
endif()

define_boolean_option(USE_ASYNCIO YES)

# define enabled features

if(BOOTLOADER STREQUAL "YES"
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ With the XL, the situation gets a bit more complex. The firmware of XLBuddy cont
- With the `ENABLE_PUPPY_BOOTLOAD` set to false, the project will disable Puppy flashing & interaction with Puppy bootloaders.
- It is up to you to flash the correct firmware to the puppies (noboot variant).
5. Keep bootloaders but do not write firmware on boot.
```
-DPUPPY_SKIP_FLASH_FW=YES
```
- With the `PUPPY_SKIP_FLASH_FW` set to true, the project will disable Puppy flashing on boot.
- You can keep other puppies that are not debugged in the same state as before.
- Use puppy build config with bootloaders (e.g. `xl-dwarf_debug_boot`) on one or more puppies.
- Recommend breakpoint at the end of `puppy_task_body()` to prevent buddy from resetting the puppy immediately when puppy stops on breakpoint.
See /ProjectOptions.cmake for more information about those cache variables.
#### Running tests
Expand Down
2 changes: 1 addition & 1 deletion cmake/ProjectVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# PROJECT_VERSION (4.0.3)
# PROJECT_VERSION_FULL (4.0.3-BETA+1035.PR111.B4)
# PROJECT_VERSION_SUFFIX (-BETA+1035.PR111.B4)
# PROJECT_VERSION_SUFFIX_SHORT (+1035)
# PROJECT_VERSION_SUFFIX_SHORT (-BETA+1035)
#
# The `PROJECT_VERSION` variable is set as soon as the file is included.
# To set the rest, the function `resolve_version_variables` has to be called.
Expand Down
6 changes: 4 additions & 2 deletions cmake/Utilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function(pack_firmware target)
BUILD_NUMBER
PRINTER_TYPE
PRINTER_VERSION
PRINTER_SUBVERSION
SIGNING_KEY
BBF_VERSION
OUTPUT_PATH
Expand Down Expand Up @@ -184,8 +185,9 @@ function(pack_firmware target)
COMMAND
"${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/utils/pack_fw.py" --version="${ARG_FW_VERSION}"
--printer-type "${ARG_PRINTER_TYPE}" --printer-version "${ARG_PRINTER_VERSION}"
--build-number "${ARG_BUILD_NUMBER}" ${sign_opts} ${resources_opts} ${bbf_version_opts}
${output_path_opts} -- "${bin_firmware_path}"
--printer-subversion "${ARG_PRINTER_SUBVERSION}" --build-number "${ARG_BUILD_NUMBER}"
${sign_opts} ${resources_opts} ${bbf_version_opts} ${output_path_opts} --
"${bin_firmware_path}"
)
endfunction()

Expand Down
2 changes: 1 addition & 1 deletion doc/logging_components.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Logging - Defined Components
This file is generated automatically so don't edit it directly

- Accelerometer: LOG_SEVERITY_WARNING, src/puppy/dwarf/accelerometer.cpp
- Accel: LOG_SEVERITY_INFO, src/puppy/dwarf/accelerometer.cpp
- Bootloader: LOG_SEVERITY_INFO, src/bootloader/bootloader.cpp
- Buddy: LOG_SEVERITY_DEBUG, src/common/appmain.cpp
- BufferedSerial: LOG_SEVERITY_DEBUG, src/hw/buffered_serial.cpp
Expand Down
8 changes: 8 additions & 0 deletions doc/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ What are metrics good for, if you have no way to store, view, and process them?
> - You can view logs of all the running services using `docker-compose logs -f`
> - To stop the services, run `docker-compose stop`
1. If you're on **WSL**, you might need to forward the UDP packets from your host machine to the WSL. For that purpose, we've written a simple UDP proxy application you can compile and run on your PC.
1. Download [DMD](https://dlang.org/) compiler.
1. Compile `metricsProxy.d` located in this directory (`doc`): `dmd metricsProxy.d`
1. Find out your WSL IP address: `(wsl) ifconfig`
1. Start the proxy: `metricsProxy.exe (your-wsl-address)`.
##### This will start the following services
1. An InfluxDB database instance storing all your metrics.
Expand Down
36 changes: 36 additions & 0 deletions doc/metricsProxy.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import std.stdio;
import std.socket;

void main(string[] args) {
auto socket = new Socket(AddressFamily.INET, SocketType.DGRAM);
socket.blocking = true;
socket.bind(new InternetAddress("0.0.0.0", 8500));

auto targetAddress = new InternetAddress(args[1], 8500);

auto buffer = new char[4096];

writeln("Running...");
size_t i = 0;

while(true) {
const auto rcvd = socket.receive(buffer);
if(rcvd == 0 || rcvd == Socket.ERROR) {
writeln(i++, " Error rcvd ", rcvd, ": ", socket.getErrorText);
continue;
}

const auto sent = socket.sendTo(buffer[0 .. rcvd], targetAddress);
if(sent == 0 || sent == Socket.ERROR) {
writeln(i++, " Error sent ", sent, ": ", socket.getErrorText);
continue;
}

if(sent != rcvd) {
writeln(i++, " Sent ", sent, " rcvd", rcvd);
continue;
}

writeln(i++, " PACKET ", sent, "\n", buffer[0..rcvd]);
}
}
2 changes: 1 addition & 1 deletion include/buddy/ffconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@

#include "cmsis_os.h" // O/S definitions
#define FF_FS_REENTRANT 1
#define FF_FS_TIMEOUT 1000
#define FF_FS_TIMEOUT portMAX_DELAY
#define FF_SYNC_t osSemaphoreId
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
Expand Down
2 changes: 1 addition & 1 deletion include/buddy/lwipopts.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extern "C" {
#define PBUF_POOL_SIZE 10
#define PBUF_POOL_SMALL_SIZE 12
#define IP_REASS_MAX_PBUFS 15
#define TCPIP_THREAD_STACKSIZE 1088
#define TCPIP_THREAD_STACKSIZE 1248
#define TCPIP_MBOX_SIZE PBUF_POOL_SIZE + PBUF_POOL_SMALL_SIZE

#define DEFAULT_UDP_RECVMBOX_SIZE TCPIP_MBOX_SIZE
Expand Down
5 changes: 3 additions & 2 deletions include/buddy/priorities_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ static_assert(configLIBRARY_LOWEST_INTERRUPT_PRIORITY == 15);
#define TASK_PRIORITY_MEDIA_PREFETCH osPriorityHigh
#define TASK_PRIORITY_METRIC_SYSTEM osPriorityAboveNormal
#define TASK_PRIORITY_USB_HOST osPriorityNormal
#define TASK_PRIORITY_USB_MSC_WORKER osPriorityRealtime
#define TASK_PRIORITY_USB_MSC_WORKER_HIGH osPriorityRealtime
#define TASK_PRIORITY_USB_MSC_WORKER_LOW osPriorityNormal
#define TASK_PRIORITY_DISPLAY_TASK osPriorityNormal
#define TASK_PRIORITY_MEASUREMENT_TASK osPriorityNormal
#define TASK_PRIORITY_ESP_UPDATE osPriorityNormal
#define TASK_PRIORITY_MEDIA_PREFETCH_WHILE_FREAD osPriorityNormal // decreased priroity when media prefetch calls fread
#define TASK_PRIORITY_TCPIP_THREAD osPriorityBelowNormal
#define TASK_PRIORITY_ASYNCIO osPriorityBelowNormal
#define TASK_PRIORITY_WUI osPriorityBelowNormal
#define TASK_PRIORITY_CONNECT osPriorityBelowNormal
static_assert(configTIMER_TASK_PRIORITY == 5); // 5 is more than osPriorityRealtime
Expand All @@ -69,6 +69,7 @@ static_assert(configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY == 0);
#define ISR_PRIORITY_DMA1_CHANNEL1 0
#define ISR_PRIORITY_TICK_TIMER 1
#define ISR_PRIORITY_HX717 1
#define ISR_PRIORITY_LIS2DH12 1
#define ISR_PRIORITY_STEP_TIMER 2
#define ISR_PRIORITY_TEMP_TIMER 2
#define ISR_PRIORITY_MOVE_TIMER 2
Expand Down
14 changes: 0 additions & 14 deletions include/buddy/usb_device.h

This file was deleted.

6 changes: 6 additions & 0 deletions include/buddy/usb_device.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once
#include "log.h"

extern log_component_t LOG_COMPONENT(USBDevice);

void usb_device_init();
2 changes: 1 addition & 1 deletion include/marlin/Configuration_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@
//! implemented only for Cartesian kinematics
#define MOVE_BACK_BEFORE_HOMING
#if ENABLED(MOVE_BACK_BEFORE_HOMING)
#define MOVE_BACK_BEFORE_HOMING_DISTANCE 10.0f
#define MOVE_BACK_BEFORE_HOMING_DISTANCE 1.92f
#endif

// Specify here all the endstop connectors that are connected to any endstop or probe.
Expand Down
8 changes: 4 additions & 4 deletions include/marlin/Configuration_MINI_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@
#define HOMING_MAX_ATTEMPTS 10

// 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
#define X_HOME_BUMP_MM 0
#define Y_HOME_BUMP_MM 0
#define Z_HOME_BUMP_MM 2
#define HOMING_BUMP_DIVISOR \
{ 1, 1, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate)
Expand Down Expand Up @@ -1744,8 +1744,8 @@
#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

// Milliseconds to wait on hold before auto-restarting during short power failures
#define POWER_PANIC_HOLD_RST_MS 5000
// seconds to wait on hold before auto-restarting during short power failures
#define POWER_PANIC_HOLD_RST_S 5

// TODO: Suboptimal values
#define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking
Expand Down
9 changes: 5 additions & 4 deletions include/marlin/Configuration_MK3.5.h
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,9 @@
* Override with M92
* X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
*/
#define DEFAULT_AXIS_STEPS_PER_UNIT_E0 266 // 95% of the original 280 to account for normalised flow
#define DEFAULT_AXIS_STEPS_PER_UNIT \
{ 100, 100, 400, 280 }
{ 100, 100, 400, DEFAULT_AXIS_STEPS_PER_UNIT_E0 }
/**
* Default Max Feed Rate (mm/s)
* Override with M203
Expand Down Expand Up @@ -1027,9 +1028,9 @@
#define DISABLE_INACTIVE_EXTRUDER // Keep only the active extruder enabled

// default values
#define DEFAULT_INVERT_X_DIR true
#define DEFAULT_INVERT_Y_DIR false
#define DEFAULT_INVERT_Z_DIR true
#define DEFAULT_INVERT_X_DIR false
#define DEFAULT_INVERT_Y_DIR true
#define DEFAULT_INVERT_Z_DIR false


#define DEFAULT_INVERT_E0_DIR false
Expand Down
4 changes: 2 additions & 2 deletions include/marlin/Configuration_MK3.5_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1752,8 +1752,8 @@
#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

// Milliseconds to wait on hold before auto-restarting during short power failures
#define POWER_PANIC_HOLD_RST_MS 5000
// seconds to wait on hold before auto-restarting during short power failures
#define POWER_PANIC_HOLD_RST_S 5

#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)
Expand Down
4 changes: 2 additions & 2 deletions include/marlin/Configuration_MK4_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1764,8 +1764,8 @@
#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

// Milliseconds to wait on hold before auto-restarting during short power failures
#define POWER_PANIC_HOLD_RST_MS 5000
// seconds to wait on hold before auto-restarting during short power failures
#define POWER_PANIC_HOLD_RST_S 5

// TODO: currently arbitrary, needs to include optimal feedrates too
#define POWER_PANIC_X_CURRENT 350 // (mA) RMS current for parking
Expand Down
Loading

0 comments on commit 28dd066

Please sign in to comment.