Skip to content

Commit

Permalink
Create proxies for $3 and $23 on behalf of grblHotwire
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchBradley committed Dec 8, 2024
1 parent 6f8aad7 commit d827900
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions FluidNC/src/Machine/Axes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ namespace Machine {
log_info("Axis " << axisName(axis) << " (" << limitsMinPosition(axis) << "," << limitsMaxPosition(axis) << ")");
a->init();
}
auto homing = a->_homing;
if (homing && !homing->_positiveDirection) {
set_bitnum(Homing::direction_mask, axis);
}
}

config_motors();
Expand Down
9 changes: 5 additions & 4 deletions FluidNC/src/Machine/Homing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ namespace Machine {
const uint32_t MOTOR0 = 0xffff;
const uint32_t MOTOR1 = 0xffff0000;

Homing::Phase Homing::_phase = Phase::None;
AxisMask Homing::_cycleAxes = 0;
AxisMask Homing::_phaseAxes = 0;
MotorMask Homing::_cycleMotors = 0;
Homing::Phase Homing::_phase = Phase::None;
AxisMask Homing::_cycleAxes = 0;
AxisMask Homing::_phaseAxes = 0;
AxisMask Homing::direction_mask = 0;
MotorMask Homing::_cycleMotors = 0;
MotorMask Homing::_phaseMotors;
std::queue<int> Homing::_remainingCycles;
uint32_t Homing::_settling_ms;
Expand Down
1 change: 1 addition & 0 deletions FluidNC/src/Machine/Homing.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace Machine {
static uint32_t _runs;

static AxisMask unhomed_axes();
static AxisMask direction_mask;

static void set_axis_homed(size_t axis);
static void set_axis_unhomed(size_t axis);
Expand Down
4 changes: 4 additions & 0 deletions FluidNC/src/SettingsDefinitions.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "Machine/MachineConfig.h"
#include "SettingsDefinitions.h"
#include "Config.h"
#include "Stepping.h"
#include "Machine/Homing.h"

#include <tuple>
#include <array>
Expand Down Expand Up @@ -109,7 +111,9 @@ void make_settings() {
FLOAT_PROXY("101", "Grbl/Resolution/Y", config._axes->_axis[1]->_stepsPerMm)
FLOAT_PROXY("102", "Grbl/Resolution/Z", config._axes->_axis[2]->_stepsPerMm)

INT_PROXY("3", "Grbl/InvertMask", Machine::Stepping::direction_mask)
INT_PROXY("20", "Grbl/SoftLimitsEnable", config._axes->_axis[0]->_softLimits)
INT_PROXY("21", "Grbl/HardLimitsEnable", config._axes->hasHardLimits())
INT_PROXY("22", "Grbl/HomingCycleEnable", (bool)Axes::homingMask)
INT_PROXY("23", "Grbl/HomingInvertMask", Homing::direction_mask)
}
6 changes: 6 additions & 0 deletions FluidNC/src/Stepping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ namespace Machine {

int Stepping::_engine = RMT_ENGINE;

AxisMask Stepping::direction_mask = 0;

bool Stepping::_switchedStepper = false;
size_t Stepping::_segments = 12;

Expand Down Expand Up @@ -78,6 +80,10 @@ void Stepping::assignMotor(int axis, int motor, int step_pin, bool step_invert,
m->dir_invert = dir_invert;
m->blocked = false;
m->limited = false;

if (motor == 0 && dir_invert) {
set_bitnum(direction_mask, axis);
}
}

int Stepping::axis_steps[MAX_N_AXIS] = { 0 };
Expand Down
2 changes: 2 additions & 0 deletions FluidNC/src/Stepping.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ namespace Machine {

static uint32_t maxPulsesPerSec();

static AxisMask direction_mask;

// Timers
static void setTimerPeriod(uint32_t timerTicks);
static void startTimer();
Expand Down

0 comments on commit d827900

Please sign in to comment.