mirror of
git://soft.sys114.com/klipper
synced 2026-02-11 10:30:26 +09:00
Compare commits
4 Commits
a5264c3d43
...
2648f8c982
| Author | SHA1 | Date | |
|---|---|---|---|
| 2648f8c982 | |||
| 0198dfaf95 | |||
| aac0542c70 | |||
| 755cc0b3c2 |
@@ -21,7 +21,7 @@
|
||||
serial: /tmp/klipper_host_mcu
|
||||
|
||||
[mcu EBBCan] # based on EBB36 CAN V1.1
|
||||
canbus_uuid: e8a11afa199b
|
||||
canbus_uuid: 1e8ea3b32c8a
|
||||
|
||||
[printer]
|
||||
kinematics: cartesian
|
||||
@@ -58,7 +58,7 @@ homing_speed: 50
|
||||
|
||||
[stepper_z]
|
||||
step_pin: gpiochip0/gpio55
|
||||
dir_pin: !gpiochip0/gpio62
|
||||
dir_pin: !gpiochip0/gpio54
|
||||
enable_pin: !gpiochip0/gpio26
|
||||
microsteps: 16
|
||||
rotation_distance: 8
|
||||
@@ -67,23 +67,23 @@ position_min: -4.0
|
||||
position_max: 300
|
||||
|
||||
[stepper_z1]
|
||||
step_pin: gpiochip0/gpio54
|
||||
step_pin: gpiochip0/gpio62
|
||||
dir_pin: !gpiochip0/gpio40
|
||||
enable_pin: !gpiochip0/gpio27
|
||||
microsteps: 16
|
||||
rotation_distance: 8
|
||||
|
||||
[extruder]
|
||||
step_pin: EBBCan: PD0
|
||||
dir_pin: EBBCan: PD1
|
||||
enable_pin: !EBBCan: PD2
|
||||
step_pin: EBBCan: PA9
|
||||
dir_pin: EBBCan: PA8
|
||||
enable_pin: !EBBCan: PA10
|
||||
microsteps: 16
|
||||
rotation_distance: 7.703694208
|
||||
nozzle_diameter: 0.400
|
||||
filament_diameter: 1.750
|
||||
heater_pin: EBBCan:PB13
|
||||
heater_pin: EBBCan:PB1
|
||||
sensor_type: EPCOS 100K B57560G104F
|
||||
sensor_pin: EBBCan:PA3
|
||||
sensor_pin: EBBCan:PA0
|
||||
control: pid
|
||||
pid_Kp: 21.527
|
||||
pid_Ki: 1.063
|
||||
@@ -159,13 +159,13 @@ hold_current: 0.500
|
||||
stealthchop_threshold: 30
|
||||
|
||||
[tmc2209 extruder]
|
||||
uart_pin: EBBCan:PA15
|
||||
uart_pin: EBBCan:PA13
|
||||
run_current: 0.800
|
||||
hold_current: 0.500
|
||||
stealthchop_threshold: 250
|
||||
|
||||
[probe]
|
||||
pin: !EBBCan:PB8
|
||||
pin: !EBBCan:PA5
|
||||
x_offset: -42.0
|
||||
y_offset: -4.0
|
||||
speed: 5.0
|
||||
@@ -240,4 +240,4 @@ gcode:
|
||||
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
|
||||
#*#
|
||||
#*# [probe]
|
||||
#*# z_offset = 0.34
|
||||
#*# z_offset = 0.34
|
||||
|
||||
@@ -21,23 +21,50 @@ DECL_CONSTANT("ADC_MAX", 1800); // Assume 12bit adc
|
||||
DECL_ENUMERATION_RANGE("pin", "analog0", ANALOG_START, 8);
|
||||
|
||||
// ODROID-C5
|
||||
#define IIO_PATH "/sys/bus/iio/devices/iio:device0/in_voltage%d_input"
|
||||
#define IIO_PATH "/sys/bus/iio/devices/iio:device0/in_voltage0_input"
|
||||
#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
|
||||
gpio_adc_setup(uint32_t pin)
|
||||
{
|
||||
char fname[256];
|
||||
snprintf(fname, sizeof(fname), IIO_PATH, pin-ANALOG_START);
|
||||
// char fname[256];
|
||||
// snprintf(fname, sizeof(fname), IIO_PATH, pin-ANALOG_START);
|
||||
|
||||
int fd = open(fname, O_RDONLY|O_CLOEXEC);
|
||||
struct gpio_adc g;
|
||||
int fd;
|
||||
char buf[64];
|
||||
int ret;
|
||||
|
||||
fd = open(SCALE_PATH, O_RDONLY);
|
||||
ret = read(fd, buf, sizeof(buf)-1);
|
||||
if (ret <= 0) {
|
||||
goto fail;
|
||||
}
|
||||
buf[ret] = '\0';
|
||||
g.scale = atoi(buf);
|
||||
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) {
|
||||
report_errno("analog open", fd);
|
||||
goto fail;
|
||||
}
|
||||
int ret = set_non_blocking(fd);
|
||||
ret = set_non_blocking(fd);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
return (struct gpio_adc){ .fd = fd };
|
||||
|
||||
g.fd = fd;
|
||||
return g;
|
||||
fail:
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
@@ -54,6 +81,7 @@ uint16_t
|
||||
gpio_adc_read(struct gpio_adc g)
|
||||
{
|
||||
char buf[64];
|
||||
int voltage;
|
||||
int ret = pread(g.fd, buf, sizeof(buf)-1, 0);
|
||||
if (ret <= 0) {
|
||||
report_errno("analog read", ret);
|
||||
@@ -61,7 +89,14 @@ gpio_adc_read(struct gpio_adc g)
|
||||
return 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
|
||||
|
||||
@@ -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);
|
||||
|
||||
struct gpio_adc {
|
||||
int scale;
|
||||
int offset;
|
||||
int fd;
|
||||
};
|
||||
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))
|
||||
return ret;
|
||||
// Next step event is too close to the last unstep
|
||||
int32_t diff = s->time.waketime - min_next_time;
|
||||
if (diff < (int32_t)-timer_from_us(1000))
|
||||
shutdown("Stepper too far in past");
|
||||
// int32_t diff = s->time.waketime - min_next_time;
|
||||
// if (diff < (int32_t)-timer_from_us(1000))
|
||||
// shutdown("Stepper too far in past");
|
||||
reschedule_min:
|
||||
s->time.waketime = min_next_time;
|
||||
return SF_RESCHEDULE;
|
||||
|
||||
Reference in New Issue
Block a user