mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-12-28 18:30:36 -07:00
🎨 Misc. HAL types, planner sq, etc.
This commit is contained in:
parent
367bcedea7
commit
baa20d9ea2
8 changed files with 24 additions and 37 deletions
|
|
@ -53,12 +53,15 @@ uint16_t MarlinHAL::adc_result;
|
|||
|
||||
// Initializes the Marlin HAL
|
||||
void MarlinHAL::init() {
|
||||
// Ensure F_CPU is a constant expression.
|
||||
// If the compiler breaks here, it means that delay code that should compute at compile time will not work.
|
||||
// So better safe than sorry here.
|
||||
constexpr unsigned int cpuFreq = F_CPU;
|
||||
UNUSED(cpuFreq);
|
||||
|
||||
#if PIN_EXISTS(LED)
|
||||
OUT_WRITE(LED_PIN, LOW);
|
||||
#endif
|
||||
#if PIN_EXISTS(LED)
|
||||
OUT_WRITE(LED_PIN, LOW);
|
||||
#endif
|
||||
|
||||
SetTimerInterruptPriorities();
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void MarlinHAL::init() {
|
|||
// Ensure F_CPU is a constant expression.
|
||||
// If the compiler breaks here, it means that delay code that should compute at compile time will not work.
|
||||
// So better safe than sorry here.
|
||||
constexpr int cpuFreq = F_CPU;
|
||||
constexpr unsigned int cpuFreq = F_CPU;
|
||||
UNUSED(cpuFreq);
|
||||
|
||||
#if HAS_MEDIA && DISABLED(ONBOARD_SDIO) && PIN_EXISTS(SD_SS)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ void MarlinHAL::init() {
|
|||
// Ensure F_CPU is a constant expression.
|
||||
// If the compiler breaks here, it means that delay code that should compute at compile time will not work.
|
||||
// So better safe than sorry here.
|
||||
constexpr int cpuFreq = F_CPU;
|
||||
constexpr unsigned int cpuFreq = F_CPU;
|
||||
UNUSED(cpuFreq);
|
||||
|
||||
#if HAS_MEDIA && DISABLED(ONBOARD_SDIO) && PIN_EXISTS(SD_SS)
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ static uint8_t ram_eeprom[MARLIN_EEPROM_SIZE] __attribute__((aligned(4))) = {0};
|
|||
static bool eeprom_dirty = false;
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
const uint32_t *source = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
|
||||
uint32_t *destination = reinterpret_cast<uint32_t*>(ram_eeprom);
|
||||
const uint32_t *src = reinterpret_cast<const uint32_t*>(EEPROM_PAGE0_BASE);
|
||||
uint32_t *dst = reinterpret_cast<uint32_t*>(ram_eeprom);
|
||||
|
||||
static_assert(0 == (MARLIN_EEPROM_SIZE) % 4, "MARLIN_EEPROM_SIZE is corrupted. (Must be a multiple of 4.)"); // Ensure copying as uint32_t is safe
|
||||
constexpr size_t eeprom_size_u32 = (MARLIN_EEPROM_SIZE) / 4;
|
||||
|
||||
for (size_t i = 0; i < eeprom_size_u32; ++i, ++destination, ++source)
|
||||
*destination = *source;
|
||||
for (size_t i = 0; i < eeprom_size_u32; ++i, ++dst, ++src)
|
||||
*dst = *src;
|
||||
|
||||
eeprom_dirty = false;
|
||||
return true;
|
||||
|
|
@ -80,9 +80,9 @@ bool PersistentStore::access_finish() {
|
|||
status = FLASH_ErasePage(EEPROM_PAGE1_BASE);
|
||||
if (status != FLASH_COMPLETE) ACCESS_FINISHED(true);
|
||||
|
||||
const uint16_t *source = reinterpret_cast<const uint16_t*>(ram_eeprom);
|
||||
for (size_t i = 0; i < long(MARLIN_EEPROM_SIZE); i += 2, ++source) {
|
||||
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + i, *source) != FLASH_COMPLETE)
|
||||
const uint16_t *src = reinterpret_cast<const uint16_t*>(ram_eeprom);
|
||||
for (size_t i = 0; i < long(MARLIN_EEPROM_SIZE); i += 2, ++src) {
|
||||
if (FLASH_ProgramHalfWord(EEPROM_PAGE0_BASE + i, *src) != FLASH_COMPLETE)
|
||||
ACCESS_FINISHED(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ typedef ab_float_t ab_pos_t;
|
|||
typedef abc_float_t abc_pos_t;
|
||||
typedef abce_float_t abce_pos_t;
|
||||
|
||||
// External conversion methods
|
||||
// External conversion methods (motion.h)
|
||||
void toLogical(xy_pos_t &raw);
|
||||
void toLogical(xyz_pos_t &raw);
|
||||
void toLogical(xyze_pos_t &raw);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "babystep.h"
|
||||
#include "../MarlinCore.h"
|
||||
#include "../module/motion.h" // for axes_should_home(), BABYSTEP_ALLOWED
|
||||
#include "../module/motion.h" // for axis_should_home(), BABYSTEP_ALLOWED
|
||||
#include "../module/planner.h" // for axis_steps_per_mm[]
|
||||
#include "../module/stepper.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -151,34 +151,18 @@ namespace MMU3 {
|
|||
#endif
|
||||
}
|
||||
|
||||
int16_t thermal_degTargetHotend() {
|
||||
return thermalManager.degTargetHotend(0);
|
||||
}
|
||||
|
||||
int16_t thermal_degHotend() {
|
||||
return thermalManager.degHotend(0);
|
||||
}
|
||||
|
||||
void thermal_setExtrudeMintemp(int16_t t) {
|
||||
thermalManager.extrude_min_temp = t;
|
||||
}
|
||||
|
||||
void thermal_setTargetHotend(int16_t t) {
|
||||
thermalManager.setTargetHotend(t, 0);
|
||||
}
|
||||
int16_t thermal_degTargetHotend() { return thermalManager.degTargetHotend(0); }
|
||||
int16_t thermal_degHotend() { return thermalManager.degHotend(0); }
|
||||
void thermal_setExtrudeMintemp(int16_t t) { thermalManager.extrude_min_temp = t; }
|
||||
void thermal_setTargetHotend(int16_t t) { thermalManager.setTargetHotend(t, 0); }
|
||||
|
||||
void safe_delay_keep_alive(uint16_t t) {
|
||||
idle(true);
|
||||
safe_delay(t);
|
||||
}
|
||||
|
||||
void Enable_E0() {
|
||||
stepper.enable_extruder(TERN_(HAS_EXTRUDERS, 0));
|
||||
}
|
||||
|
||||
void Disable_E0() {
|
||||
stepper.disable_extruder(TERN_(HAS_EXTRUDERS, 0));
|
||||
}
|
||||
void Enable_E0() { stepper.enable_extruder(TERN_(HAS_EXTRUDERS, 0)); }
|
||||
void Disable_E0() { stepper.disable_extruder(TERN_(HAS_EXTRUDERS, 0)); }
|
||||
|
||||
bool xy_are_trusted() {
|
||||
return axis_is_trusted(X_AXIS) && axis_is_trusted(Y_AXIS);
|
||||
|
|
|
|||
|
|
@ -3262,7 +3262,7 @@ void Planner::refresh_positioning() {
|
|||
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
|
||||
LOOP_DISTINCT_AXES(i) mm_per_step[i] = 1.0f / settings.axis_steps_per_mm[i];
|
||||
#if ALL(NONLINEAR_EXTRUSION, SMOOTH_LIN_ADVANCE)
|
||||
stepper.ne.q30.A = _BV32(30) * (stepper.ne.settings.coeff.A * mm_per_step[E_AXIS_N(0)] * mm_per_step[E_AXIS_N(0)]);
|
||||
stepper.ne.q30.A = _BV32(30) * (stepper.ne.settings.coeff.A * sq(mm_per_step[E_AXIS_N(0)]));
|
||||
stepper.ne.q30.B = _BV32(30) * (stepper.ne.settings.coeff.B * mm_per_step[E_AXIS_N(0)]);
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue