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

This commit is contained in:
Andrew 2025-10-21 07:25:45 -04:00
commit 1fcebc7fa2
40 changed files with 217 additions and 81 deletions

View file

@ -1183,7 +1183,7 @@
//#define FTM_SMOOTHING // Smoothing can reduce artifacts and make steppers quieter
// on sharp corners, but too much will round corners.
#if ENABLED(FTM_SMOOTHING)
#define FTM_MAX_SMOOTHING_TIME 0.10f // Maximum smoothing time (seconds), higher consumes more RAM.
#define FTM_MAX_SMOOTHING_TIME 0.10f // (s) Maximum smoothing time. Higher values consume more RAM.
// Increase smoothing time to reduce jerky motion, ghosting and noises.
#define FTM_SMOOTHING_TIME_X 0.00f // (s) Smoothing time for X axis. Zero means disabled.
#define FTM_SMOOTHING_TIME_Y 0.00f // (s) Smoothing time for Y axis
@ -1212,7 +1212,7 @@
#define FTM_BATCH_SIZE 100 // Custom Batch size for trajectory generation needed by Ulendo FBS
#endif
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation. (Reciprocal of FTM_TS)
#define FTM_FS 1000 // (Hz) Frequency for trajectory generation
#if DISABLED(COREXY)
#define FTM_STEPPER_FS 20000 // (Hz) Frequency for stepper I/O update
@ -4718,6 +4718,11 @@
//
//#define PINS_DEBUGGING
//
// M265 - I2C Scanner
//
//#define I2C_SCANNER
// Enable Tests that will run at startup and produce a report
//#define MARLIN_TEST_BUILD

View file

@ -41,7 +41,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
//#define STRING_DISTRIBUTION_DATE "2025-10-17"
//#define STRING_DISTRIBUTION_DATE "2025-10-21"
/**
* The protocol for communication to the host. Protocol indicates communication

View file

@ -254,7 +254,7 @@ uint16_t set_pwm_frequency_hz(const float hz, const float dca, const float dcb,
else { prescaler = 1; SET_CS(5, PRESCALER_1); }
count /= float(prescaler);
const float pwm_top = round(count); // Get the rounded count
const float pwm_top = roundf(count); // Get the rounded count
ICR5 = (uint16_t)pwm_top - 1; // Subtract 1 for TOP
OCR5A = pwm_top * ABS(dca); // Update and scale DCs
@ -280,7 +280,7 @@ uint16_t set_pwm_frequency_hz(const float hz, const float dca, const float dcb,
SET_CS(5, PRESCALER_64); // 16MHz / 64 = 250kHz
OCR5A = OCR5B = OCR5C = 0;
}
return round(count);
return roundf(count);
}
#endif

View file

@ -26,4 +26,4 @@
#define TS_TYPICAL_SLOPE 4.5
// TODO: Implement voltage scaling (calibrated Vrefint) and ADC resolution scaling (when applicable)
#define TEMP_SOC_SENSOR(RAW) ((TS_TYPICAL_V - (RAW) / float(OVERSAMPLENR) / float(HAL_ADC_RANGE) * (float(ADC_VREF_MV) / 1000.0f)) / ((TS_TYPICAL_SLOPE) / 1000.0f) + TS_TYPICAL_TEMP)
#define TEMP_SOC_SENSOR(RAW) ((TS_TYPICAL_V - (RAW) / float(OVERSAMPLENR) / float(HAL_ADC_RANGE) * (float(ADC_VREF_MV) * 0.001f)) / ((TS_TYPICAL_SLOPE) * 0.001f) + TS_TYPICAL_TEMP)

View file

@ -83,7 +83,7 @@ bool PersistentStore::access_start() {
NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_PBC;
while (NVMCTRL->INTFLAG.bit.READY == 0) { }
PAGE_SIZE = pow(2,3 + NVMCTRL->PARAM.bit.PSZ);
PAGE_SIZE = POW(2, 3 + NVMCTRL->PARAM.bit.PSZ);
ROW_SIZE= PAGE_SIZE * 4;
/*NVMCTRL->SEECFG.reg = NVMCTRL_SEECFG_WMODE_BUFFERED; // Buffered mode and segment reallocation active
if (NVMCTRL->SEESTAT.bit.RLOCK)

View file

@ -98,7 +98,7 @@ void MarlinHAL::clear_reset_source() {
#define WDT_TIMEOUT TERN(WATCHDOG_DURATION_8S, 8, 4) // 4 or 8 second timeout
constexpr uint8_t timeoutval = (WDT_TIMEOUT - 0.5f) / 0.5f;
constexpr uint8_t timeoutval = (WDT_TIMEOUT - 0.5f) * 2.0f;
void MarlinHAL::watchdog_init() {
CCM_CCGR3 |= CCM_CCGR3_WDOG1(3); // enable WDOG1 clocks

View file

@ -101,7 +101,7 @@ bool BDS_Leveling::check(const uint16_t data, const bool raw_data/*=false*/, con
}
float BDS_Leveling::interpret(const uint16_t data) {
return (data & 0x3FF) / 100.0f;
return (data & 0x3FF) * 0.01f;
}
float BDS_Leveling::read() {

View file

@ -68,7 +68,7 @@ void StepperDAC::set_current_value(const uint8_t channel, uint16_t val) {
}
void StepperDAC::set_current_percent(const uint8_t channel, float val) {
set_current_value(channel, _MIN(val, 100.0f) * (DAC_STEPPER_MAX) / 100.0f);
set_current_value(channel, _MIN(val, 100.0f) * (DAC_STEPPER_MAX) * 0.01f);
}
static float dac_perc(int8_t n) { return mcp4728.getDrvPct(dac_order[n]); }

View file

@ -67,7 +67,7 @@ public:
}
// Convert raw measurement to mm
static float raw_to_mm(const uint16_t v) { return v * (float(ADC_VREF_MV) / 1000.0f) * RECIPROCAL(float(MAX_RAW_THERMISTOR_VALUE)); }
static float raw_to_mm(const uint16_t v) { return v * (float(ADC_VREF_MV) * 0.001f) * RECIPROCAL(float(MAX_RAW_THERMISTOR_VALUE)); }
static float raw_to_mm() { return raw_to_mm(raw); }
// A scaled reading is ready

View file

@ -212,7 +212,7 @@ void ProbeTempComp::compensate_measurement(const TempSensorID tsi, const celsius
}
// convert offset to mm and apply it
meas_z -= offset / 1000.0f;
meas_z -= offset * 0.001f;
}
bool ProbeTempComp::linear_regression(const TempSensorID tsi, float &k, float &d) {

View file

@ -60,7 +60,7 @@ public:
// Convert configured power range to a percentage
static constexpr cutter_cpower_t power_floor = TERN(CUTTER_POWER_RELATIVE, SPEED_POWER_MIN, 0);
static constexpr uint8_t cpwr_to_pct(const cutter_cpower_t cpwr) {
return cpwr ? round(100.0f * (cpwr - power_floor) / (SPEED_POWER_MAX - power_floor)) : 0;
return cpwr ? LROUND(100.0f * (cpwr - power_floor) / (SPEED_POWER_MAX - power_floor)) : 0;
}
// Convert config defines from RPM to %, angle or PWM when in Spindle mode
@ -164,7 +164,7 @@ public:
*/
static cutter_power_t power_to_range(const cutter_power_t pwr, const uint8_t pwrUnit=_CUTTER_POWER(CUTTER_POWER_UNIT)) {
static constexpr float
min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, round(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN)),
min_pct = TERN(CUTTER_POWER_RELATIVE, 0, TERN(SPINDLE_FEATURE, roundf(100.0f * (SPEED_POWER_MIN) / (SPEED_POWER_MAX)), SPEED_POWER_MIN)),
max_pct = TERN(SPINDLE_FEATURE, 100, SPEED_POWER_MAX);
if (pwr <= 0) return 0;
cutter_power_t upwr;

View file

@ -154,7 +154,7 @@ static float std_dev_points(float z_pt[NPP + 1], const bool _0p_cal, const bool
S2 += sq(z_pt[rad]);
N++;
}
return LROUND(SQRT(S2 / N) * 1000.0f) / 1000.0f + 0.00001f;
return LROUND(SQRT(S2 / N) * 1000.0f) * 0.001f + 0.00001f;
}
}
return 0.00001f;
@ -315,7 +315,7 @@ static void calc_kinematics_diff_probe_points(float z_pt[NPP + 1], const float d
static float auto_tune_h(const float dcr) {
const float r_quot = dcr / delta_radius;
return RECIPROCAL(r_quot / (2.0f / 3.0f)); // (2/3)/CR
return RECIPROCAL(r_quot * (3.0f / 2.0f)); // (2/3)/CR
}
static float auto_tune_r(const float dcr) {
@ -490,7 +490,7 @@ void GcodeSuite::G33() {
float z_at_pt[NPP + 1] = { 0.0f };
test_precision = zero_std_dev_old != 999.0f ? (zero_std_dev + zero_std_dev_old) / 2.0f : zero_std_dev;
test_precision = zero_std_dev_old != 999.0f ? (zero_std_dev + zero_std_dev_old) * 0.5f : zero_std_dev;
iterations++;
// Probe the points
@ -527,7 +527,7 @@ void GcodeSuite::G33() {
* - Definition of the matrix scaling parameters
* - Matrices for 4 and 7 point calibration
*/
#define ZP(N,I) ((N) * z_at_pt[I] / 4.0f) // 4.0 = divider to normalize to integers
#define ZP(N,I) ((N) * z_at_pt[I] * 0.25f) // 4.0 = divider to normalize to integers
#define Z12(I) ZP(12, I)
#define Z4(I) ZP(4, I)
#define Z2(I) ZP(2, I)

View file

@ -0,0 +1,69 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2025 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(I2C_SCANNER)
#include "../../../libs/hex_print.h"
#include "../../gcode.h"
#include <Wire.h> // Include Wire library for I2C communication
/**
* M265: I2C Scanner - Scan for I2C devices on DOGLCD I2C pins
*
* Usage: M265
*
* Scans I2C addresses 0x08 to 0x77 and reports any responding devices.
*/
void GcodeSuite::M265() {
Wire.begin();
int device_count = 0;
SERIAL_ECHOLNPGM("Scanning I2C (0x08-0x77)...");
for (uint8_t address = 0x08; address <= 0x77; address++) {
Wire.beginTransmission(address);
const uint8_t error = Wire.endTransmission();
if (error == 0) {
// Device found
device_count++;
SERIAL_ECHOLNPGM("I2C device found at address 0x", hex_byte(address));
}
else if (error == 4)
SERIAL_ECHOLNPGM("Unknown error at address 0x", hex_byte(address));
safe_delay(5); // Small delay between scans
}
SERIAL_ECHOPGM("I2C scan complete. ");
if (device_count == 0)
SERIAL_ECHOLNPGM("No I2C devices found");
else {
SERIAL_ECHOLN("Found ", device_count, " device");
if (device_count > 1) SERIAL_CHAR('s');
SERIAL_EOL();
}
}
#endif // I2C_SCANNER

View file

@ -826,6 +826,10 @@ void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) {
case 261: M261(); break; // M261: Request data from an i2c slave
#endif
#if ENABLED(I2C_SCANNER)
case 265: M265(); break; // M265: I2C Scanner
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
case 302: M302(); break; // M302: Allow cold extrudes (set the minimum extrude temperature)
#endif

View file

@ -211,6 +211,7 @@
* M256 - Set LCD brightness: 'M256 B<brightness>' (0-255). (Requires an LCD with brightness control)
* M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
* M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS)
* M265 - i2c Scanner - Scan for I2C devices. (Requires I2C_SCANNER)
* M280 - Set servo position absolute: 'M280 P<index> S<angle|µs>'. (Requires servos)
* M281 - Set servo min|max position: 'M281 P<index> L<min> U<max>'. (Requires EDITABLE_SERVO_ANGLES)
* M282 - Detach servo: 'M282 P<index>'. (Requires SERVO_DETACH_GCODE)
@ -965,6 +966,10 @@ private:
static void M261();
#endif
#if ENABLED(I2C_SCANNER)
static void M265();
#endif
#if HAS_SERVOS
static void M280();
#if ENABLED(EDITABLE_SERVO_ANGLES)

View file

@ -3651,7 +3651,7 @@
#endif
// Flag whether hex_print.cpp is needed
#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE, DEBUG_CARDREADER, M20_TIMESTAMP_SUPPORT, HAS_STM32_UID)
#if ANY(AUTO_BED_LEVELING_UBL, M100_FREE_MEMORY_WATCHER, DEBUG_GCODE_PARSER, TMC_DEBUG, MARLIN_DEV_MODE, DEBUG_CARDREADER, M20_TIMESTAMP_SUPPORT, HAS_STM32_UID, I2C_SCANNER)
#define NEED_HEX_PRINT 1
#endif

View file

@ -42,7 +42,7 @@
* version was tagged.
*/
#ifndef STRING_DISTRIBUTION_DATE
#define STRING_DISTRIBUTION_DATE "2025-10-17"
#define STRING_DISTRIBUTION_DATE "2025-10-21"
#endif
/**

View file

@ -408,7 +408,7 @@ void dwinDrawFloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t
// value: positive unscaled float value
void dwinDrawFloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
const int32_t val = round(value * POW(10, fNum));
const int32_t val = LROUND(value * POW(10, fNum));
dwinDrawFloatValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, val);
}

View file

@ -96,7 +96,7 @@
// Minimum unit (0.1) : multiple (10)
#define UNITFDIGITS 1
#define MINUNITMULT pow(10, UNITFDIGITS)
#define MINUNITMULT POW(10, UNITFDIGITS)
#define DWIN_VAR_UPDATE_INTERVAL 1000
#define DWIN_SCROLL_UPDATE_INTERVAL SEC_TO_MS(2)
@ -1392,7 +1392,7 @@ void hmiMoveDone(const AxisEnum axis) {
LIMIT(hmiValues.offset_value, _OFFSET_ZMIN * 100, _OFFSET_ZMAX * 100);
last_zoffset = dwin_zoffset;
dwin_zoffset = hmiValues.offset_value / 100.0f;
dwin_zoffset = hmiValues.offset_value * 0.01f;
#if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
if (BABYSTEP_ALLOWED()) babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset);
#endif

View file

@ -378,8 +378,8 @@ private:
dwinDrawRectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/
isnan(bedlevel.z_values[x][y]) ? COLOR_GREY : ( // gray if undefined
(bedlevel.z_values[x][y] < 0 ?
(uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? rmax : v_min)) << 11 : // red if mesh point value is negative
(uint16_t)round(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? rmax : v_max)) << 5) | // green if mesh point value is positive
(uint16_t)LROUND(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? rmax : v_min)) << 11 : // red if mesh point value is negative
(uint16_t)LROUND(0x3F * bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? rmax : v_max)) << 5) | // green if mesh point value is positive
_MIN(0x1F, (((uint8_t)abs(bedlevel.z_values[x][y]) / 10) * 4))), // + blue stepping for every mm
start_x_px, start_y_px, end_x_px, end_y_px
);
@ -1518,7 +1518,7 @@ void JyersDWIN::menuItemHandler(const uint8_t menu, const uint8_t item, bool dra
if (use_probe) {
#if HAS_BED_PROBE
gcode.process_subcommands_now(
TS(F("G0F4000\nG0Z10\nG0X"), p_float_t((X_MAX_POS) / 2.0f - probe.offset.x, 3), 'Y', p_float_t((Y_MAX_POS) / 2.0f - probe.offset.y, 3))
TS(F("G0F4000\nG0Z10\nG0X"), p_float_t((X_MAX_POS) * 0.5f - probe.offset.x, 3), 'Y', p_float_t((Y_MAX_POS) * 0.5f - probe.offset.y, 3))
);
planner.synchronize();
popupHandler(Popup_ManualProbing);
@ -5100,7 +5100,7 @@ void JyersDWIN::loadSettings(const char * const buff) {
memcpy(&eeprom_settings, buff, _MIN(sizeof(eeprom_settings), eeprom_data_size));
TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1);
if (eeprom_settings.corner_pos == 0) eeprom_settings.corner_pos = 325;
corner_pos = eeprom_settings.corner_pos / 10.0f;
corner_pos = eeprom_settings.corner_pos * 0.1f;
redrawScreen();
#if ENABLED(POWER_LOSS_RECOVERY)
static bool init = true;
@ -5127,7 +5127,7 @@ void JyersDWIN::resetSettings() {
eeprom_settings.coordinates_text = 0;
eeprom_settings.coordinates_split_line = 0;
TERN_(AUTO_BED_LEVELING_UBL, mesh_conf.tilt_grid = eeprom_settings.tilt_grid_size + 1);
corner_pos = eeprom_settings.corner_pos / 10.0f;
corner_pos = eeprom_settings.corner_pos * 0.1f;
TERN_(SOUND_MENU_ITEM, ui.sound_on = ENABLED(SOUND_ON_DEFAULT));
redrawScreen();
}

View file

@ -226,10 +226,10 @@ bool BedLevelTools::meshValidate() {
const auto start_y_px = padding_y_top + ((GRID_MAX_POINTS_Y) - y - 1) * cell_height_px;
const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width;
const float z = bedlevel.z_values[x][y];
const uint16_t color = isnan(z) ? COLOR_GREY : ( // Gray if undefined
(z < 0 ? uint16_t(round(0x1F * -z / rmax)) << 11 // Red for negative mesh point
: uint16_t(round(0x3F * z / rmax)) << 5) // Green for positive mesh point
| _MIN(0x1F, (uint8_t(abs(z) * 0.4))) // + Blue stepping for every mm
const uint16_t color = isnan(z) ? COLOR_GREY : ( // Gray if undefined
(z < 0 ? uint16_t(LROUND(0x1F * -z / rmax)) << 11 // Red for negative mesh point
: uint16_t(LROUND(0x3F * z / rmax)) << 5) // Green for positive mesh point
| _MIN(0x1F, (uint8_t(abs(z) * 0.4))) // + Blue stepping for every mm
);
dwinDrawRectangle(1, color, start_x_px, start_y_px, end_x_px, end_y_px);

View file

@ -2169,13 +2169,13 @@ void autoHome() { queue.inject_P(G28_STR); }
void applyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); }
void liveZOffset() {
#if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
const float step_zoffset = round((menuData.value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum;
const float step_zoffset = roundf((menuData.value * 0.01f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum;
if (BABYSTEP_ALLOWED()) babystep.add_steps(Z_AXIS, step_zoffset);
#endif
}
void setZOffset() {
#if ANY(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
babystep.accum = round(planner.settings.axis_steps_per_mm[Z_AXIS] * BABY_Z_VAR);
babystep.accum = LROUND(planner.settings.axis_steps_per_mm[Z_AXIS] * BABY_Z_VAR);
#endif
setPFloatOnClick(PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX, 2, applyZOffset, liveZOffset);
}

View file

@ -213,7 +213,7 @@ void setValueOnClick(uint8_t process, const int32_t lo, const int32_t hi, const
// liveUpdate: live update function when the encoder changes
// apply: update function when the encoder is pressed
void setValueOnClick(uint8_t process, const float lo, const float hi, uint8_t dp, const float val, void (*apply)()/*=nullptr*/, void (*liveUpdate)()/*=nullptr*/) {
const int32_t value = round(val * POW(10, dp));
const int32_t value = LROUND(val * POW(10, dp));
setOnClick(process, lo * POW(10, dp), hi * POW(10, dp), dp, value, apply, liveUpdate);
DrawItemEdit(true);
}

View file

@ -75,7 +75,7 @@ void MeshViewer::drawMeshGrid(const uint8_t csizex, const uint8_t csizey) {
void MeshViewer::drawMeshPoint(const uint8_t x, const uint8_t y, const float z) {
const uint8_t fs = DWINUI::fontWidth(meshfont);
const int16_t v = isnan(z) ? 0 : round(z * 100);
const int16_t v = isnan(z) ? int16_t(0) : int16_t(LROUND(z * 100));
NOLESS(max, z); NOMORE(min, z);
const uint16_t color = DWINUI::rainbowInt(v, zmin, zmax);

View file

@ -542,7 +542,7 @@ void DGUSScreenHandler::handleSettings(DGUS_VP_Variable &var, void *val_ptr) {
#if HAS_BED_PROBE
void DGUSScreenHandler::handleProbeOffsetZChanged(DGUS_VP_Variable &var, void *val_ptr) {
const float offset = float(int16_t(BE16_P(val_ptr))) / 100.0f;
const float offset = float(int16_t(BE16_P(val_ptr))) * 0.01f;
ExtUI::setZOffset_mm(offset);
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
return;

View file

@ -199,7 +199,7 @@ public:
if (var.memadr) {
float f = *(float *)var.memadr;
f *= cpow(10, decimals);
dgus.writeVariable(var.VP, (long)f);
dgus.writeVariable(var.VP, LROUND(f));
}
}
@ -212,7 +212,7 @@ public:
float f = *(float *)var.memadr;
DEBUG_ECHOLNPGM(" >> ", p_float_t(f, 6));
f *= cpow(10, decimals);
dgus.writeVariable(var.VP, (int16_t)f);
dgus.writeVariable(var.VP, (int16_t)LROUND(f));
}
}

View file

@ -382,7 +382,7 @@ void DGUSScreenHandlerMKS::zOffsetSelect(DGUS_VP_Variable &var, void *val_ptr) {
void DGUSScreenHandlerMKS::getOffsetValue(DGUS_VP_Variable &var, void *val_ptr) {
#if HAS_BED_PROBE
const float offset = BE32_P(val_ptr) / 100.0f;
const float offset = BE32_P(val_ptr) * 0.01f;
switch (var.VP) {
default: break;
case VP_OFFSET_X: probe.offset.x = offset; break;

View file

@ -183,7 +183,7 @@
void DGUSTxHandler::zPosition(DGUS_VP &vp) {
const float position = ExtUI::isAxisPositionKnown(ExtUI::Z) ? planner.get_axis_position_mm(Z_AXIS) : 0;
const int32_t data = dgus.toFixedPoint<float, int32_t, 2>(int32_t(position * 50.0f) / 50.0f); // Round to 0.02
const int32_t data = dgus.toFixedPoint<float, int32_t, 2>(int32_t(position * 50.0f) * 0.02f); // Round to 0.02
dgus.write((uint16_t)vp.addr, dgus.swapBytes(data));
}

View file

@ -62,7 +62,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
break;
case ID_C_DEC:
if (!editingFlowrate)
feedrate_percentage = _MAX(MIN_EXT_SPEED_PERCENT, feedrate_percentage + uiCfg.stepPrintSpeed);
feedrate_percentage = _MAX(MIN_EXT_SPEED_PERCENT, feedrate_percentage - uiCfg.stepPrintSpeed);
else {
const int16_t new_flow = _MAX(MIN_EXT_SPEED_PERCENT, planner.flow_percentage[0] - uiCfg.stepPrintSpeed);
planner.set_flow(0, new_flow);

View file

@ -850,7 +850,7 @@ namespace ExtUI {
{ backlash.set_distance_mm((AxisEnum)axis, constrain(value,0,5)); }
float getBacklashCorrection_percent() { return backlash.get_correction() * 100.0f; }
void setBacklashCorrection_percent(const float value) { backlash.set_correction(constrain(value, 0, 100) / 100.0f); }
void setBacklashCorrection_percent(const float value) { backlash.set_correction(constrain(value, 0, 100) * 0.01f); }
#ifdef BACKLASH_SMOOTHING_MM
float getBacklashSmoothing_mm() { return backlash.get_smoothing_mm(); }

View file

@ -838,7 +838,7 @@ void RTS::handleData() {
#endif
case Heater0LoadEnterKey:
filament_load_0 = float(recdat.data[0]) / 10.0f;
filament_load_0 = float(recdat.data[0]) * 0.1f;
break;
case AxisPageSelectKey: // Mobile shaft interface
@ -948,7 +948,7 @@ void RTS::handleData() {
#if HAS_X_AXIS
case XaxismoveKey: {
waitway = 4;
current_position.x = float(recdat.data[0] >= 32768 ? recdat.data[0] - 65536 : recdat.data[0]) / 10.0f;
current_position.x = float(recdat.data[0] >= 32768 ? recdat.data[0] - 65536 : recdat.data[0]) * 0.1f;
LIMIT(current_position.x, X_MIN_POS, X_MAX_POS);
RTS_line_to_current(X_AXIS);
sendData(current_position.x * 10.0f, AXIS_X_COORD_VP);
@ -960,7 +960,7 @@ void RTS::handleData() {
#if HAS_Y_AXIS
case YaxismoveKey: {
waitway = 4;
current_position.y = float(recdat.data[0]) / 10.0f;
current_position.y = float(recdat.data[0]) * 0.1f;
LIMIT(current_position.y, Y_MIN_POS, Y_MAX_POS);
RTS_line_to_current(Y_AXIS);
sendData(current_position.y * 10.0f, AXIS_Y_COORD_VP);
@ -972,7 +972,7 @@ void RTS::handleData() {
#if HAS_Z_AXIS
case ZaxismoveKey: {
waitway = 4;
current_position.z = float(recdat.data[0]) / 10.0f;
current_position.z = float(recdat.data[0]) * 0.1f;
LIMIT(current_position.z, Z_MIN_POS, Z_MAX_POS);
RTS_line_to_current(Z_AXIS);
sendData(current_position.z * 10.0f, AXIS_Z_COORD_VP);
@ -1229,7 +1229,7 @@ void RTS::handleData() {
case 1: { // PID
#if ENABLED(PIDTEMP)
const float hot_p = thermalManager.temp_hotend[0].pid.p() * 100.0f,
hot_i = (thermalManager.temp_hotend[0].pid.i() / 8.0f * 10000.0f) + 0.00001f,
hot_i = (thermalManager.temp_hotend[0].pid.i() * 0.125f * 10000.0f) + 0.00001f,
hot_d = thermalManager.temp_hotend[0].pid.d() * 8.0f;
sendData(hot_p, Nozzle_P_VP);
sendData(hot_i, Nozzle_I_VP);
@ -1238,7 +1238,7 @@ void RTS::handleData() {
#if ENABLED(PIDTEMPBED)
const float bed_p = thermalManager.temp_bed.pid.p() * 100.0f,
bed_i = (thermalManager.temp_bed.pid.i() / 8.0f * 10000.0f) + 0.0001f,
bed_i = (thermalManager.temp_bed.pid.i() * 0.125f * 10000.0f) + 0.0001f,
bed_d = thermalManager.temp_bed.pid.d() * 0.8f;
sendData(bed_p, Hot_Bed_P_VP);
@ -1306,51 +1306,51 @@ void RTS::handleData() {
break;
#if ENABLED(PIDTEMP)
case Nozzle_P: SET_HOTEND_PID(Kp, 0, float(recdat.data[0]) / 100.0f); thermalManager.updatePID(); break;
case Nozzle_I: SET_HOTEND_PID(Ki, 0, float(recdat.data[0]) * 8.0f / 10000.0f); thermalManager.updatePID(); break;
case Nozzle_D: SET_HOTEND_PID(Kd, 0, float(recdat.data[0]) / 8.0f); thermalManager.updatePID(); break;
case Nozzle_P: SET_HOTEND_PID(Kp, 0, float(recdat.data[0]) * 0.01f); thermalManager.updatePID(); break;
case Nozzle_I: SET_HOTEND_PID(Ki, 0, float(recdat.data[0]) * 8.0f * 0.0001f); thermalManager.updatePID(); break;
case Nozzle_D: SET_HOTEND_PID(Kd, 0, float(recdat.data[0]) * 0.125f); thermalManager.updatePID(); break;
#endif
#if ENABLED(PIDTEMPBED)
case Hot_Bed_P: thermalManager.temp_bed.pid.set_Kp(float(recdat.data[0]) / 100.0f); break;
case Hot_Bed_I: thermalManager.temp_bed.pid.set_Ki(float(recdat.data[0]) * 8.0f / 10000.0f); break;
case Hot_Bed_D: thermalManager.temp_bed.pid.set_Kd(float(recdat.data[0]) / 0.8f); break;
case Hot_Bed_P: thermalManager.temp_bed.pid.set_Kp(float(recdat.data[0]) * 0.01f); break;
case Hot_Bed_I: thermalManager.temp_bed.pid.set_Ki(float(recdat.data[0]) * 8.0f * 0.0001f); break;
case Hot_Bed_D: thermalManager.temp_bed.pid.set_Kd(float(recdat.data[0]) * 1.25); break;
#endif
#if HAS_X_AXIS
case Vmax_X: planner.settings.max_feedrate_mm_s[X_AXIS] = recdat.data[0]; break;
case Amax_X: planner.settings.max_acceleration_mm_per_s2[X_AXIS] = recdat.data[0]; break;
case Steps_X: planner.settings.axis_steps_per_mm[X_AXIS] = float(recdat.data[0]) / 10.0f; break;
case Steps_X: planner.settings.axis_steps_per_mm[X_AXIS] = float(recdat.data[0]) * 0.1f; break;
#if ENABLED(CLASSIC_JERK)
case Jerk_X: planner.max_jerk.x = float(recdat.data[0]) / 10.0f; break;
case Jerk_X: planner.max_jerk.x = float(recdat.data[0]) * 0.1f; break;
#endif
#endif
#if HAS_Y_AXIS
case Vmax_Y: planner.settings.max_feedrate_mm_s[Y_AXIS] = recdat.data[0]; break;
case Amax_Y: planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = recdat.data[0]; break;
case Steps_Y: planner.settings.axis_steps_per_mm[Y_AXIS] = float(recdat.data[0]) / 10.0f; break;
case Steps_Y: planner.settings.axis_steps_per_mm[Y_AXIS] = float(recdat.data[0]) * 0.1f; break;
#if ENABLED(CLASSIC_JERK)
case Jerk_Y: planner.max_jerk.y = float(recdat.data[0]) / 10.0f; break;
case Jerk_Y: planner.max_jerk.y = float(recdat.data[0]) * 0.1f; break;
#endif
#endif
#if HAS_Z_AXIS
case Vmax_Z: planner.settings.max_feedrate_mm_s[Z_AXIS] = recdat.data[0]; break;
case Amax_Z: planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = recdat.data[0]; break;
case Steps_Z: planner.settings.axis_steps_per_mm[Z_AXIS] = float(recdat.data[0]) / 10.0f; break;
case Steps_Z: planner.settings.axis_steps_per_mm[Z_AXIS] = float(recdat.data[0]) * 0.1f; break;
#if ENABLED(CLASSIC_JERK)
case Jerk_Z: planner.max_jerk.z = float(recdat.data[0]) / 10.0f; break;
case Jerk_Z: planner.max_jerk.z = float(recdat.data[0]) * 0.1f; break;
#endif
#endif
#if HAS_HOTEND
case Vmax_E: planner.settings.max_feedrate_mm_s[E_AXIS] = recdat.data[0]; break;
case Amax_E: planner.settings.max_acceleration_mm_per_s2[E_AXIS] = recdat.data[0]; break;
case Steps_E: planner.settings.axis_steps_per_mm[E_AXIS] = float(recdat.data[0]) / 10.0f; break;
case Steps_E: planner.settings.axis_steps_per_mm[E_AXIS] = float(recdat.data[0]) * 0.1f; break;
#if ENABLED(CLASSIC_JERK)
case Jerk_E: planner.max_jerk.e = float(recdat.data[0]) / 10.0f; break;
case Jerk_E: planner.max_jerk.e = float(recdat.data[0]) * 0.1f; break;
#endif
case A_Retract: planner.settings.retract_acceleration = recdat.data[0]; break;
#if ENABLED(LIN_ADVANCE)
case Advance_K: planner.set_advance_k(float(recdat.data[0]) / 100.0f); break;
case Advance_K: planner.set_advance_k(float(recdat.data[0]) * 0.01f); break;
#endif
#endif
case Accel: planner.settings.acceleration = recdat.data[0]; break;
@ -1384,7 +1384,7 @@ void RTS::handleData() {
case ZOffsetKey:
last_zoffset = zprobe_zoffset;
zprobe_zoffset = float(recdat.data[0] >= 32767 ? recdat.data[0] - 65537 : recdat.data[0]) / 100.0f + 0.0001f;
zprobe_zoffset = float(recdat.data[0] >= 32767 ? recdat.data[0] - 65537 : recdat.data[0]) * 0.01f + 0.0001f;
if (WITHIN(zprobe_zoffset, PROBE_OFFSET_ZMIN, PROBE_OFFSET_ZMAX))
babystep.add_mm(Z_AXIS, zprobe_zoffset - last_zoffset);
probe.offset.z = zprobe_zoffset;

View file

@ -41,7 +41,7 @@ template <typename T>
constexpr char MINUSOR(T &n, const char alt) { return (n >= 0) ? alt : (n = -n) ? '-' : '-'; }
constexpr long INTFLOAT(const float V, const int N) {
return long((V * 10.0f * pow(10.0f, N) + (V < 0.0f ? -5.0f : 5.0f)) / 10.0f);
return long((V * 10.0f * pow(10.0f, N) + (V < 0.0f ? -5.0f : 5.0f)) * 0.1f);
}
constexpr long UINTFLOAT(const float V, const int N) {
return INTFLOAT(V < 0.0f ? -V : V, N);

View file

@ -31,6 +31,10 @@
#include "stepper.h" // Access stepper block queue function and abort status.
#include "endstops.h"
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../feature/powerloss.h"
#endif
FTMotion ftMotion;
//-----------------------------------------------------------------
@ -170,6 +174,12 @@ void FTMotion::loop() {
continue;
}
loadBlockData(stepper.current_block);
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.info.sdpos = stepper.current_block->sdpos;
recovery.info.current_position = stepper.current_block->start_position;
#endif
blockProcRdy = true;
// Some kinematics track axis motion in HX, HY, HZ
@ -292,7 +302,7 @@ void FTMotion::loop() {
case ftMotionShaper_2HEI: {
max_i = 3U;
const float vtolx2 = sq(vtol);
const float X = pow(vtolx2 * (sqrt(1.0f - vtolx2) + 1.0f), 1.0f / 3.0f);
const float X = POW(vtolx2 * (sqrt(1.0f - vtolx2) + 1.0f), 1.0f / 3.0f);
Ai[0] = (3.0f * sq(X) + 2.0f * X + 3.0f * vtolx2) / (16.0f * X);
Ai[1] = (0.5f - Ai[0]) * K;
Ai[2] = Ai[1] * K;
@ -338,28 +348,28 @@ void FTMotion::loop() {
const float df = sqrt ( 1.f - sq(zeta) );
switch (shaper) {
case ftMotionShaper_ZV:
Ni[1] = round((0.5f / f / df) * (FTM_FS));
Ni[1] = LROUND((0.5f / f / df) * (FTM_FS));
break;
case ftMotionShaper_ZVD:
case ftMotionShaper_EI:
Ni[1] = round((0.5f / f / df) * (FTM_FS));
Ni[1] = LROUND((0.5f / f / df) * (FTM_FS));
Ni[2] = Ni[1] + Ni[1];
break;
case ftMotionShaper_ZVDD:
case ftMotionShaper_2HEI:
Ni[1] = round((0.5f / f / df) * (FTM_FS));
Ni[1] = LROUND((0.5f / f / df) * (FTM_FS));
Ni[2] = Ni[1] + Ni[1];
Ni[3] = Ni[2] + Ni[1];
break;
case ftMotionShaper_ZVDDD:
case ftMotionShaper_3HEI:
Ni[1] = round((0.5f / f / df) * (FTM_FS));
Ni[1] = LROUND((0.5f / f / df) * (FTM_FS));
Ni[2] = Ni[1] + Ni[1];
Ni[3] = Ni[2] + Ni[1];
Ni[4] = Ni[3] + Ni[1];
break;
case ftMotionShaper_MZV:
Ni[1] = round((0.375f / f / df) * (FTM_FS));
Ni[1] = LROUND((0.375f / f / df) * (FTM_FS));
Ni[2] = Ni[1] + Ni[1];
break;
case ftMotionShaper_NONE:
@ -373,7 +383,7 @@ void FTMotion::loop() {
float centroid = 0.0f;
for (uint8_t i = 1; i <= max_i; ++i) centroid -= Ai[i] * Ni[i];
Ni[0] = round(centroid);
Ni[0] = LROUND(centroid);
// The resulting echo index can be negative, this is ok because it will be offset
// by the max delay of all axes before it is used.

View file

@ -3069,7 +3069,7 @@ bool Planner::buffer_line(const xyze_pos_t &cart, const feedRate_t fr_mm_s
calculated_feedrate = settings.max_feedrate_mm_s[Y_AXIS];
else {
// Normalized vector of movement
const float diffBLength = ABS((2.0f * M_PI * diff.a) * (diff.b / 360.0f)),
const float diffBLength = ABS((2.0f * M_PI * diff.a) * (diff.b * 0.002777777778)), // ÷ 360
diffTheta = DEGREES(ATAN2(diff.a, diffBLength)),
normalizedTheta = 1.0f - (ABS(diffTheta > 90.0f ? 180.0f - diffTheta : diffTheta) / 90.0f);

View file

@ -1122,7 +1122,7 @@ void Temperature::factory_reset() {
if (ELAPSED(curr_time_ms, next_test_ms)) {
if (current_temp >= ambient_temp) {
ambient_temp = (ambient_temp + current_temp) / 2.0f;
ambient_temp = (ambient_temp + current_temp) * 0.5f;
break;
}
ambient_temp = current_temp;
@ -1884,7 +1884,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id OPTARG(ERR_INCLUDE_T
float power = 0.0;
if (hotend.target != 0 && !is_idling) {
// Plan power level to get to target temperature in 2 seconds
power = (hotend.target - hotend.modeled_block_temp) * mpc.block_heat_capacity / 2.0f;
power = (hotend.target - hotend.modeled_block_temp) * mpc.block_heat_capacity * 0.5f;
power -= (hotend.modeled_ambient_temp - hotend.modeled_block_temp) * ambient_xfer_coeff;
}
@ -2602,7 +2602,7 @@ void Temperature::task() {
#if ANY_THERMISTOR_IS(-1)
// For a 5V input the AD595 returns a value scaled with 10mV per °C. (Minimum input voltage is 5V.)
static constexpr celsius_float_t temp_ad595(const raw_adc_t raw) {
return raw * (float(ADC_VREF_MV) / 10.0f) / float(HAL_ADC_RANGE) / (OVERSAMPLENR)
return raw * (float(ADC_VREF_MV) * 0.1f) / float(HAL_ADC_RANGE) / (OVERSAMPLENR)
* (TEMP_SENSOR_AD595_GAIN) + (TEMP_SENSOR_AD595_OFFSET);
}
#endif

View file

@ -770,6 +770,12 @@
#if PIN_EXISTS(FAN7)
REPORT_NAME_DIGITAL(__LINE__, FAN7_PIN)
#endif
#if PIN_EXISTS(FAN8)
REPORT_NAME_DIGITAL(__LINE__, FAN8_PIN)
#endif
#if PIN_EXISTS(FAN9)
REPORT_NAME_DIGITAL(__LINE__, FAN9_PIN)
#endif
#if PIN_EXISTS(FAN_MUX0)
REPORT_NAME_DIGITAL(__LINE__, FAN_MUX0_PIN)
#endif
@ -954,6 +960,12 @@
#if PIN_EXISTS(LCD_BACKLIGHT)
REPORT_NAME_DIGITAL(__LINE__, LCD_BACKLIGHT_PIN)
#endif
#if PIN_EXISTS(DOGLCD_SCL)
REPORT_NAME_DIGITAL(__LINE__, DOGLCD_SCL_PIN)
#endif
#if PIN_EXISTS(DOGLCD_SDA)
REPORT_NAME_DIGITAL(__LINE__, DOGLCD_SDA_PIN)
#endif
//
// LED Lights
@ -1038,6 +1050,30 @@
#if PIN_EXISTS(TEMP_1_MISO)
REPORT_NAME_DIGITAL(__LINE__, TEMP_1_MISO_PIN)
#endif
#if PIN_EXISTS(TEMP_2_CS)
REPORT_NAME_DIGITAL(__LINE__, TEMP_2_CS_PIN)
#endif
#if PIN_EXISTS(TEMP_2_SCK)
REPORT_NAME_DIGITAL(__LINE__, TEMP_2_SCK_PIN)
#endif
#if PIN_EXISTS(TEMP_2_MOSI)
REPORT_NAME_DIGITAL(__LINE__, TEMP_2_MOSI_PIN)
#endif
#if PIN_EXISTS(TEMP_2_MISO)
REPORT_NAME_DIGITAL(__LINE__, TEMP_2_MISO_PIN)
#endif
#if PIN_EXISTS(TEMP_3_CS)
REPORT_NAME_DIGITAL(__LINE__, TEMP_3_CS_PIN)
#endif
#if PIN_EXISTS(TEMP_3_SCK)
REPORT_NAME_DIGITAL(__LINE__, TEMP_3_SCK_PIN)
#endif
#if PIN_EXISTS(TEMP_3_MOSI)
REPORT_NAME_DIGITAL(__LINE__, TEMP_3_MOSI_PIN)
#endif
#if PIN_EXISTS(TEMP_3_MISO)
REPORT_NAME_DIGITAL(__LINE__, TEMP_3_MISO_PIN)
#endif
//
// MOSFETs (RAMPS)
@ -1199,6 +1235,12 @@
#if PIN_EXISTS(SERVO3)
REPORT_NAME_DIGITAL(__LINE__, SERVO3_PIN)
#endif
#if PIN_EXISTS(SERVO4)
REPORT_NAME_DIGITAL(__LINE__, SERVO4_PIN)
#endif
#if PIN_EXISTS(SERVO5)
REPORT_NAME_DIGITAL(__LINE__, SERVO5_PIN)
#endif
#if PIN_EXISTS(SHIFT_CLK)
REPORT_NAME_DIGITAL(__LINE__, SHIFT_CLK_PIN)

View file

@ -9,5 +9,5 @@ set -e
#
# Build with the default configurations
#
use_example_configs BIQU/BX
exec_test $1 $2 "BIQU/BX" "$3"
use_example_configs BIQU/BX/base
exec_test $1 $2 "BIQU/BX/base" "$3"

View file

@ -39,7 +39,7 @@ exec_test $1 $2 "RAMPS4DUE_EFB with ABL (Bilinear), ExtUI, S-Curve, many options
restore_configs
opt_set MOTHERBOARD BOARD_RADDS Z_DRIVER_TYPE A4988 Z2_DRIVER_TYPE A4988 Z3_DRIVER_TYPE A4988 \
X_MAX_PIN -1 Y_MAX_PIN -1
opt_enable ENDSTOPPULLUPS BLTOUCH AUTO_BED_LEVELING_BILINEAR \
opt_enable ENDSTOPPULLUPS BLTOUCH AUTO_BED_LEVELING_BILINEAR I2C_SCANNER \
Z_STEPPER_AUTO_ALIGN Z_STEPPER_ALIGN_STEPPER_XY Z_SAFE_HOMING
exec_test $1 $2 "RADDS with ABL (Bilinear), Triple Z Axis, Z_STEPPER_AUTO_ALIGN, E_DUAL_STEPPER_DRIVERS" "$3"

View file

@ -268,7 +268,8 @@ HAS_FILAMENT_SENSOR = build_src_filter=+<src/feature/runout.c
MK2_MULTIPLEXER = build_src_filter=+<src/feature/snmm.cpp>
HAS_CUTTER = build_src_filter=+<src/feature/spindle_laser.cpp> +<src/gcode/control/M3-M5.cpp>
HAS_DRIVER_SAFE_POWER_PROTECT = build_src_filter=+<src/feature/stepper_driver_safety.cpp>
EXPERIMENTAL_I2CBUS = build_src_filter=+<src/feature/twibus.cpp> +<src/gcode/feature/i2c>
EXPERIMENTAL_I2CBUS = build_src_filter=+<src/feature/twibus.cpp> +<src/gcode/feature/i2c/M260_M261.cpp>
I2C_SCANNER = build_src_filter=+<src/gcode/feature/i2c/M265.cpp>
G26_MESH_VALIDATION = build_src_filter=+<src/gcode/bedlevel/G26.cpp>
ASSISTED_TRAMMING = build_src_filter=+<src/feature/tramming.cpp> +<src/gcode/bedlevel/G35.cpp>
HAS_MESH = build_src_filter=+<src/gcode/bedlevel/G42.cpp>