mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-12-28 18:30:36 -07:00
⚡️ Prefer multiply over divide
This commit is contained in:
parent
cfac549240
commit
8acd39c494
18 changed files with 46 additions and 46 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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]); }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1388,7 +1388,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
|
||||
|
|
|
|||
|
|
@ -1523,7 +1523,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);
|
||||
|
|
@ -5112,7 +5112,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;
|
||||
|
|
@ -5139,7 +5139,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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2169,7 +2169,7 @@ 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 = roundf((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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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(); }
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue