mirror of
git://soft.sys114.com/klipper
synced 2026-02-11 21:50:26 +09:00
Compare commits
11 Commits
odroidc5
...
c16ad7f034
| Author | SHA1 | Date | |
|---|---|---|---|
| c16ad7f034 | |||
| f5e991d50c | |||
| 6c68c5fa9f | |||
| f23a7fd3d0 | |||
| 927aebdce0 | |||
| 35eb38bfde | |||
| eb6a5a9ca0 | |||
| 6326b4e20c | |||
| 99f172156a | |||
| d51a5477fb | |||
| 764f276529 |
5
80-can.network
Normal file
5
80-can.network
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[Match]
|
||||||
|
Name=can0
|
||||||
|
|
||||||
|
[CAN]
|
||||||
|
BitRate=1000000
|
||||||
@@ -53,7 +53,7 @@ homing_retract_dist: 2
|
|||||||
microsteps: 16
|
microsteps: 16
|
||||||
rotation_distance: 40
|
rotation_distance: 40
|
||||||
position_endstop: 0
|
position_endstop: 0
|
||||||
position_max: 230
|
position_max: 200
|
||||||
homing_speed: 50
|
homing_speed: 50
|
||||||
|
|
||||||
[stepper_z]
|
[stepper_z]
|
||||||
@@ -101,10 +101,10 @@ heater_temp: 50.0
|
|||||||
heater_pin: gpiochip0/gpio65
|
heater_pin: gpiochip0/gpio65
|
||||||
sensor_type: ATC Semitec 104GT-2
|
sensor_type: ATC Semitec 104GT-2
|
||||||
sensor_pin: analog0
|
sensor_pin: analog0
|
||||||
control = pid
|
control: pid
|
||||||
pid_kp = 76.549
|
pid_Kp: 21.527
|
||||||
pid_ki = 0.974
|
pid_Ki: 1.063
|
||||||
pid_kd = 1504.195
|
pid_Kd: 108.982
|
||||||
min_temp: 0
|
min_temp: 0
|
||||||
max_temp: 85
|
max_temp: 85
|
||||||
|
|
||||||
@@ -173,8 +173,8 @@ speed: 5.0
|
|||||||
[bed_mesh]
|
[bed_mesh]
|
||||||
speed: 80
|
speed: 80
|
||||||
mesh_min: 0,0
|
mesh_min: 0,0
|
||||||
mesh_max: 180,270
|
mesh_max: 150,150
|
||||||
probe_count: 3,3
|
probe_count: 5,5
|
||||||
|
|
||||||
[bed_screws]
|
[bed_screws]
|
||||||
screw1: 30,25
|
screw1: 30,25
|
||||||
|
|||||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,3 +1,9 @@
|
|||||||
|
klipper (0.13.0) stable; urgency=medium
|
||||||
|
|
||||||
|
* Version up
|
||||||
|
|
||||||
|
-- YoungSoo Shin <shinys000114@gmail.com> Wed, 04 Jun 2025 09:47:26 +0900
|
||||||
|
|
||||||
klipper (0.1) stable; urgency=medium
|
klipper (0.1) stable; urgency=medium
|
||||||
|
|
||||||
* Initial release.
|
* Initial release.
|
||||||
|
|||||||
37
debian/control
vendored
37
debian/control
vendored
@@ -4,35 +4,30 @@ Uploaders: Dongjin Kim <tobetter@gmail.com>
|
|||||||
Section: utils
|
Section: utils
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Build-Depends: debhelper (>=9),
|
Build-Depends: debhelper (>=9),
|
||||||
python2,
|
|
||||||
python-setuptools,
|
|
||||||
pypy,
|
|
||||||
pypy-setuptools,
|
|
||||||
dh-python,
|
|
||||||
dh-systemd,
|
|
||||||
gcc-arm-none-eabi,
|
|
||||||
libnewlib-arm-none-eabi,
|
|
||||||
libnewlib-dev,
|
|
||||||
build-essential,
|
build-essential,
|
||||||
libc6-dev,
|
libc6-dev,
|
||||||
gcc-avr,
|
dh-virtualenv (>= 1.0),
|
||||||
avr-libc
|
python3,
|
||||||
Standards-Version: 3.9.5
|
python3-dev,
|
||||||
X-Python-Version: >= 2.7
|
python3-pip,
|
||||||
Vcs-Browser: https://github.com/tobetter/klipper.git
|
libffi-dev,
|
||||||
Vcs-Git: https://github.com/tobetter/klipper.git
|
|
||||||
|
|
||||||
|
Standards-Version: 3.9.5
|
||||||
Package: klipper
|
Package: klipper
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${misc:Depends}, ${python:Depends},
|
Depends: ${misc:Depends},
|
||||||
curl,
|
python3,
|
||||||
gcc-aarch64-linux-gnu,
|
python3-dev,
|
||||||
python2-dev,
|
virtualenv,
|
||||||
libffi-dev
|
libffi-dev,
|
||||||
|
build-essential,
|
||||||
|
libusb-dev,
|
||||||
|
libusb-1.0-0,
|
||||||
|
usbutils,
|
||||||
Description: Klipper Host software
|
Description: Klipper Host software
|
||||||
...
|
...
|
||||||
|
|
||||||
Package: klipper-mcu
|
Package: klipper-mcu-odroidc5
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
Description: Klipper MCU firmware
|
Description: Klipper MCU firmware
|
||||||
|
|||||||
1
debian/klipper-mcu-odroidc5.install
vendored
Normal file
1
debian/klipper-mcu-odroidc5.install
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
firmware/* /usr/share/klipper/firmware/
|
||||||
21
debian/klipper-mcu-odroidc5.service
vendored
Normal file
21
debian/klipper-mcu-odroidc5.service
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#Systemd klipper linux mcu Service
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Starts the MCU Linux firmware for klipper on startup
|
||||||
|
Documentation=https://www.klipper3d.org/RPi_microcontroller.html
|
||||||
|
Before=klipper.service
|
||||||
|
ConditionFileIsExecutable=/usr/share/klipper/firmware/LINUX/klipper_mcu
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Environment=KLIPPER_HOST_MCU_SERIAL=/tmp/klipper_host_mcu
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/share/klipper/firmware/LINUX/klipper_mcu -r -I ${KLIPPER_HOST_MCU_SERIAL}
|
||||||
|
ExecStop=sh -c 'echo "FORCE_SHUTDOWN" > ${KLIPPER_HOST_MCU_SERIAL}'
|
||||||
|
ExecStop=sleep 1
|
||||||
|
TimeoutStopSec=2
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
2
debian/klipper-mcu.install
vendored
2
debian/klipper-mcu.install
vendored
@@ -1,2 +0,0 @@
|
|||||||
firmware/* /usr/share/klipper/firmware/
|
|
||||||
scripts/klipper-mcu /etc/init.d/
|
|
||||||
7
debian/klipper.install
vendored
7
debian/klipper.install
vendored
@@ -1,3 +1,4 @@
|
|||||||
config/* /usr/share/klipper/config/
|
config/* /var/printer_data/config/
|
||||||
scripts/klippy-requirements.txt /usr/share/klipper/
|
klippy/* /usr/share/klippy
|
||||||
scripts/klipper /etc/init.d/
|
can.conf /lib/modules-load.d/
|
||||||
|
80-can.network /lib/systemd/network/
|
||||||
20
debian/klipper.postinst
vendored
20
debian/klipper.postinst
vendored
@@ -1,22 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
KLIPPER_CONFIG_PATH=/etc/klippy_config
|
mkdir -p "/var/printer_data/logs"
|
||||||
DEFAULT_CONFIG=generic-bigtreetech-skr-v1.3.cfg
|
ln -s example-odroidc5.cfg /var/printer_data/config/printer.cfg
|
||||||
|
|
||||||
## Install required Python packages
|
|
||||||
|
|
||||||
if [ ! `which pip2` ]; then
|
|
||||||
curl https://bootstrap.pypa.io/get-pip.py --output /tmp/get-pip.py
|
|
||||||
python2 /tmp/get-pip.py
|
|
||||||
fi
|
|
||||||
|
|
||||||
/usr/local/bin/pip install -r /usr/share/klipper/klippy-requirements.txt
|
|
||||||
|
|
||||||
## Default printer configuration
|
|
||||||
mkdir -p ${KLIPPER_CONFIG_PATH}
|
|
||||||
if [ ! -f ${KLIPPER_CONFIG_PATH}/printer.cfg ]; then
|
|
||||||
ln -s /usr/share/klipper/config/$DEFAULT_CONFIG \
|
|
||||||
${KLIPPER_CONFIG_PATH}/printer.cfg
|
|
||||||
fi
|
|
||||||
|
|
||||||
#DEBHELPER#
|
#DEBHELPER#
|
||||||
|
|||||||
12
debian/klipper.service
vendored
12
debian/klipper.service
vendored
@@ -1,5 +1,6 @@
|
|||||||
|
#Systemd service file for klipper
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Klipper service
|
Description=Starts klipper on startup
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
@@ -8,7 +9,8 @@ WantedBy=multi-user.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
ExecStart=python2 /usr/lib/pypy/dist-packages/klippy/klippy.py \
|
ExecStart=/opt/venvs/klipper/bin/python3 \
|
||||||
/etc/klippy_config/printer.cfg \
|
usr/share/klippy/klippy.py \
|
||||||
-l /tmp/klippy.log \
|
/var/printer_data/config/printer.cfg \
|
||||||
-a /tmp/klippy_uds
|
-l /var/printer_data/logs/klippy.log \
|
||||||
|
-a /tmp/klipper.sock
|
||||||
38
debian/rules
vendored
38
debian/rules
vendored
@@ -1,35 +1,31 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
export PYBUILD_DESTDIR_pypy=debian/klipper
|
|
||||||
|
|
||||||
define firmware
|
define firmware
|
||||||
make distclean
|
make distclean
|
||||||
echo CONFIG_MACH_$(1)=y | tr -d '[[:space:]]' \
|
echo CONFIG_MACH_LINUX=y | tr -d '[[:space:]]' \
|
||||||
> $(shell pwd)/.config && make olddefconfig
|
> $(shell pwd)/.config && make olddefconfig
|
||||||
TOPDIR=$(shell pwd) make
|
TOPDIR=$(shell pwd) make
|
||||||
mkdir -p $(shell pwd)/firmware/$(1)
|
mkdir -p $(shell pwd)/firmware/LINUX
|
||||||
cp out/$(2) $(shell pwd)/firmware/$(1)/$(3)
|
cp out/klipper.elf $(shell pwd)/firmware/LINUX/klipper_mcu
|
||||||
endef
|
endef
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --with=python2 --buildsystem=pybuild --with=systemd
|
dh $@ --with python-virtualenv --with systemd
|
||||||
|
|
||||||
override_dh_auto_build:
|
override_dh_auto_configure:
|
||||||
dh_auto_build
|
|
||||||
$(call firmware,LINUX,klipper.elf,klipper_mcu)
|
$(call firmware,LINUX,klipper.elf,klipper_mcu)
|
||||||
$(call firmware,LPC176X,klipper.bin,FIRMWARE.BIN)
|
dh_auto_configure
|
||||||
$(call firmware,at90usb1286,klipper.elf.hex,klipper.elf.hex)
|
|
||||||
$(call firmware,at90usb646,klipper.elf.hex,klipper.elf.hex)
|
override_dh_virtualenv:
|
||||||
$(call firmware,atmega1280,klipper.elf.hex,klipper.elf.hex)
|
dh_virtualenv --requirements scripts/klippy-requirements.txt --no-package klipper-mcu-odroidc5 --skip-install
|
||||||
$(call firmware,atmega1284p,klipper.elf.hex,klipper.elf.hex)
|
|
||||||
$(call firmware,atmega168,klipper.elf.hex,klipper.elf.hex)
|
override_dh_strip:
|
||||||
$(call firmware,atmega2560,klipper.elf.hex,klipper.elf.hex)
|
dh_strip --exclude=/site-packages/
|
||||||
$(call firmware,atmega328,klipper.elf.hex,klipper.elf.hex)
|
|
||||||
$(call firmware,atmega328p,klipper.elf.hex,klipper.elf.hex)
|
override_dh_shlibdeps:
|
||||||
$(call firmware,atmega32u4,klipper.elf.hex,klipper.elf.hex)
|
dh_shlibdeps --exclude=/site-packages/
|
||||||
$(call firmware,atmega644p,klipper.elf.hex,klipper.elf.hex)
|
|
||||||
|
|
||||||
override_dh_auto_install:
|
override_dh_auto_install:
|
||||||
dh_auto_install
|
dh_auto_install
|
||||||
dh_systemd_enable || true
|
dh_systemd_enable || false
|
||||||
dh_systemd_start || true
|
dh_systemd_start || false
|
||||||
@@ -70,7 +70,7 @@ def lookup_tmc_uart_mutex(mcu):
|
|||||||
pmutexes.mcu_to_mutex[mcu] = mutex
|
pmutexes.mcu_to_mutex[mcu] = mutex
|
||||||
return mutex
|
return mutex
|
||||||
|
|
||||||
TMC_BAUD_RATE = 40000
|
TMC_BAUD_RATE = 9600
|
||||||
TMC_BAUD_RATE_AVR = 9000
|
TMC_BAUD_RATE_AVR = 9000
|
||||||
|
|
||||||
# Code for sending messages on a TMC uart
|
# Code for sending messages on a TMC uart
|
||||||
|
|||||||
@@ -13,29 +13,55 @@
|
|||||||
#include "internal.h" // report_errno
|
#include "internal.h" // report_errno
|
||||||
#include "sched.h" // sched_shutdown
|
#include "sched.h" // sched_shutdown
|
||||||
|
|
||||||
DECL_CONSTANT("ADC_MAX", 4095); // Assume 12bit adc
|
// ODROID-C5
|
||||||
|
DECL_CONSTANT("ADC_MAX", 1800);
|
||||||
|
|
||||||
#define ANALOG_START (1<<12)
|
#define ANALOG_START (1<<12)
|
||||||
|
|
||||||
DECL_ENUMERATION_RANGE("pin", "analog0", ANALOG_START, 8);
|
DECL_ENUMERATION_RANGE("pin", "analog0", ANALOG_START, 8);
|
||||||
|
|
||||||
#define IIO_PATH "/sys/bus/iio/devices/iio:device0/in_voltage%d_raw"
|
// ODROID-C5
|
||||||
|
#define IIO_PATH "/sys/bus/iio/devices/iio:device0/in_voltage0_raw"
|
||||||
|
#define SCALE_PATH "/sys/bus/iio/devices/iio:device0/in_voltage_scale"
|
||||||
|
#define OFFSET_PATH "/sys/bus/iio/devices/iio:device0/in_voltage_offset"
|
||||||
|
|
||||||
struct gpio_adc
|
struct gpio_adc
|
||||||
gpio_adc_setup(uint32_t pin)
|
gpio_adc_setup(uint32_t pin)
|
||||||
{
|
{
|
||||||
char fname[256];
|
struct gpio_adc g;
|
||||||
snprintf(fname, sizeof(fname), IIO_PATH, pin-ANALOG_START);
|
int fd;
|
||||||
|
char buf[64];
|
||||||
|
int ret;
|
||||||
|
|
||||||
int fd = open(fname, O_RDONLY|O_CLOEXEC);
|
fd = open(SCALE_PATH, O_RDONLY);
|
||||||
|
ret = read(fd, buf, sizeof(buf)-1);
|
||||||
|
if (ret <= 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
buf[ret] = '\0';
|
||||||
|
g.scale = atof(buf) * 1000;
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
fd = open(OFFSET_PATH, O_RDONLY);
|
||||||
|
ret = read(fd, buf, sizeof(buf)-1);
|
||||||
|
if (ret <= 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
buf[ret] = '\0';
|
||||||
|
g.offset = atoi(buf);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
fd = open(IIO_PATH, O_RDONLY|O_CLOEXEC);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
report_errno("analog open", fd);
|
report_errno("analog open", fd);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
int ret = set_non_blocking(fd);
|
ret = set_non_blocking(fd);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
return (struct gpio_adc){ .fd = fd };
|
|
||||||
|
g.fd = fd;
|
||||||
|
return g;
|
||||||
fail:
|
fail:
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
close(fd);
|
close(fd);
|
||||||
@@ -52,6 +78,7 @@ uint16_t
|
|||||||
gpio_adc_read(struct gpio_adc g)
|
gpio_adc_read(struct gpio_adc g)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
int voltage;
|
||||||
int ret = pread(g.fd, buf, sizeof(buf)-1, 0);
|
int ret = pread(g.fd, buf, sizeof(buf)-1, 0);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
report_errno("analog read", ret);
|
report_errno("analog read", ret);
|
||||||
@@ -59,7 +86,14 @@ gpio_adc_read(struct gpio_adc g)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
buf[ret] = '\0';
|
buf[ret] = '\0';
|
||||||
return atoi(buf);
|
|
||||||
|
voltage = atoi(buf) + g.offset;
|
||||||
|
voltage = voltage > 0 ? voltage : 0;
|
||||||
|
voltage = voltage * g.scale;
|
||||||
|
voltage = voltage < 1800000 ? voltage : 1800000;
|
||||||
|
voltage /= 1000;
|
||||||
|
|
||||||
|
return voltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ void gpio_in_reset(struct gpio_in g, int8_t pull_up);
|
|||||||
uint8_t gpio_in_read(struct gpio_in g);
|
uint8_t gpio_in_read(struct gpio_in g);
|
||||||
|
|
||||||
struct gpio_adc {
|
struct gpio_adc {
|
||||||
|
int scale;
|
||||||
|
int offset;
|
||||||
int fd;
|
int fd;
|
||||||
};
|
};
|
||||||
struct gpio_adc gpio_adc_setup(uint32_t pin);
|
struct gpio_adc gpio_adc_setup(uint32_t pin);
|
||||||
|
|||||||
@@ -172,9 +172,9 @@ stepper_event_full(struct timer *t)
|
|||||||
if (ret == SF_DONE || !timer_is_before(s->time.waketime, min_next_time))
|
if (ret == SF_DONE || !timer_is_before(s->time.waketime, min_next_time))
|
||||||
return ret;
|
return ret;
|
||||||
// Next step event is too close to the last unstep
|
// Next step event is too close to the last unstep
|
||||||
int32_t diff = s->time.waketime - min_next_time;
|
// int32_t diff = s->time.waketime - min_next_time;
|
||||||
if (diff < (int32_t)-timer_from_us(1000))
|
// if (diff < (int32_t)-timer_from_us(1000))
|
||||||
shutdown("Stepper too far in past");
|
// shutdown("Stepper too far in past");
|
||||||
reschedule_min:
|
reschedule_min:
|
||||||
s->time.waketime = min_next_time;
|
s->time.waketime = min_next_time;
|
||||||
return SF_RESCHEDULE;
|
return SF_RESCHEDULE;
|
||||||
|
|||||||
Reference in New Issue
Block a user