mirror of
https://github.com/sinseman44/PyCNC.git
synced 2026-07-16 08:37:09 +00:00
run on oses without /proc/cpuinfo and fix lines width
This commit is contained in:
+10
-9
@@ -1,4 +1,4 @@
|
|||||||
# ------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Hardware config.
|
# Hardware config.
|
||||||
|
|
||||||
# Maximum velocity for each axis in millimeter per minute.
|
# Maximum velocity for each axis in millimeter per minute.
|
||||||
@@ -23,9 +23,9 @@ STEPPER_INVERTED_Y = False
|
|||||||
STEPPER_INVERTED_Z = False
|
STEPPER_INVERTED_Z = False
|
||||||
STEPPER_INVERTED_E = True
|
STEPPER_INVERTED_E = True
|
||||||
|
|
||||||
# Invert zero end stops switches. By default(False) low level on input pin means
|
# Invert zero end stops switches. By default(False) low level on input pin
|
||||||
# that axis in zero position. For inverted(True) end stops, high level means
|
# means that axis in zero position. For inverted(True) end stops, high level
|
||||||
# zero position.
|
# means zero position.
|
||||||
ENDSTOP_INVERTED_X = True
|
ENDSTOP_INVERTED_X = True
|
||||||
ENDSTOP_INVERTED_Y = True
|
ENDSTOP_INVERTED_Y = True
|
||||||
ENDSTOP_INVERTED_Z = True
|
ENDSTOP_INVERTED_Z = True
|
||||||
@@ -49,7 +49,7 @@ BED_PID = {"P": 5.06820175723,
|
|||||||
"I": 0.0476413193519,
|
"I": 0.0476413193519,
|
||||||
"D": 4.76413193519}
|
"D": 4.76413193519}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Pins configuration.
|
# Pins configuration.
|
||||||
|
|
||||||
STEPPER_STEP_PIN_X = 16
|
STEPPER_STEP_PIN_X = 16
|
||||||
@@ -73,7 +73,7 @@ ENDSTOP_PIN_X = 12
|
|||||||
ENDSTOP_PIN_Y = 6
|
ENDSTOP_PIN_Y = 6
|
||||||
ENDSTOP_PIN_Z = 5
|
ENDSTOP_PIN_Z = 5
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Behavior config
|
# Behavior config
|
||||||
|
|
||||||
# Run command immediately after receiving and stream new pulses, otherwise
|
# Run command immediately after receiving and stream new pulses, otherwise
|
||||||
@@ -82,7 +82,8 @@ ENDSTOP_PIN_Z = 5
|
|||||||
# enough for streaming pulses(faster then real time).
|
# enough for streaming pulses(faster then real time).
|
||||||
INSTANT_RUN = True
|
INSTANT_RUN = True
|
||||||
|
|
||||||
# If this parameter is False, error will be raised on command with velocity more
|
# If this parameter is False, error will be raised on command with velocity
|
||||||
# than maximum velocity specified here. If this parameter is True, velocity
|
# more than maximum velocity specified here. If this parameter is True,
|
||||||
# Would be decreased(proportional for all axises) to fit the maximum velocity.
|
# velocity would be decreased(proportional for all axises) to fit the maximum
|
||||||
|
# velocity.
|
||||||
AUTO_VELOCITY_ADJUSTMENT = True
|
AUTO_VELOCITY_ADJUSTMENT = True
|
||||||
|
|||||||
+2
-2
@@ -241,8 +241,8 @@ class GMachine(object):
|
|||||||
def safe_zero(self, x=True, y=True, z=True):
|
def safe_zero(self, x=True, y=True, z=True):
|
||||||
""" Move head to zero position safely.
|
""" Move head to zero position safely.
|
||||||
:param x: boolean, move X axis to zero
|
:param x: boolean, move X axis to zero
|
||||||
:param y: boolean, move X axis to zero
|
:param y: boolean, move Y axis to zero
|
||||||
:param z: boolean, move X axis to zero
|
:param z: boolean, move Z axis to zero
|
||||||
"""
|
"""
|
||||||
if x and not y:
|
if x and not y:
|
||||||
self._move_linear(Coordinates(-self._position.x, 0, 0, 0),
|
self._move_linear(Coordinates(-self._position.x, 0, 0, 0),
|
||||||
|
|||||||
@@ -12,21 +12,25 @@ import ctypes
|
|||||||
RPI1_PERI_BASE = 0x20000000
|
RPI1_PERI_BASE = 0x20000000
|
||||||
RPI2_3_PERI_BASE = 0x3F000000
|
RPI2_3_PERI_BASE = 0x3F000000
|
||||||
# detect board version
|
# detect board version
|
||||||
with open("/proc/cpuinfo", "r") as f:
|
try:
|
||||||
d = f.read()
|
with open("/proc/cpuinfo", "r") as f:
|
||||||
r = re.search("^Revision\s+:\s+(.+)$", d, flags=re.MULTILINE)
|
d = f.read()
|
||||||
h = re.search("^Hardware\s+:\s+(.+)$", d, flags=re.MULTILINE)
|
r = re.search("^Revision\s+:\s+(.+)$", d, flags=re.MULTILINE)
|
||||||
RPI_1_REVISIONS = ['0002', '0003', '0004', '0005', '0006', '0007', '0008',
|
h = re.search("^Hardware\s+:\s+(.+)$", d, flags=re.MULTILINE)
|
||||||
'0009', '000d', '000e', '000f', '0010', '0011', '0012',
|
RPI_1_REVISIONS = ['0002', '0003', '0004', '0005', '0006', '0007',
|
||||||
'0013', '0014', '0015', '900021', '900032']
|
'0008', '0009', '000d', '000e', '000f', '0010',
|
||||||
if h is None:
|
'0011', '0012', '0013', '0014', '0015', '900021',
|
||||||
raise ImportError("This is not raspberry pi board.")
|
'900032']
|
||||||
elif r.group(1) in RPI_1_REVISIONS:
|
if h is None:
|
||||||
PERI_BASE = RPI1_PERI_BASE
|
raise ImportError("This is not raspberry pi board.")
|
||||||
elif "BCM2" in h.group(1):
|
elif r.group(1) in RPI_1_REVISIONS:
|
||||||
PERI_BASE = RPI2_3_PERI_BASE
|
PERI_BASE = RPI1_PERI_BASE
|
||||||
else:
|
elif "BCM2" in h.group(1):
|
||||||
raise ImportError("Unknown board.")
|
PERI_BASE = RPI2_3_PERI_BASE
|
||||||
|
else:
|
||||||
|
raise ImportError("Unknown board.")
|
||||||
|
except IOError:
|
||||||
|
raise ImportError("/proc/cpuinfo not found. Not Linux device?")
|
||||||
PAGE_SIZE = 4096
|
PAGE_SIZE = 4096
|
||||||
GPIO_REGISTER_BASE = 0x200000
|
GPIO_REGISTER_BASE = 0x200000
|
||||||
GPIO_INPUT_OFFSET = 0x34
|
GPIO_INPUT_OFFSET = 0x34
|
||||||
|
|||||||
Reference in New Issue
Block a user