Compare commits
2 Commits
29611f6d43
...
fixturemap
| Author | SHA1 | Date | |
|---|---|---|---|
| facd40cc9d | |||
| 5253648cfb |
@@ -12,11 +12,13 @@ typedef struct {
|
|||||||
uint8_t homed:1;
|
uint8_t homed:1;
|
||||||
uint8_t trigger_step:1;
|
uint8_t trigger_step:1;
|
||||||
int16_t pos;
|
int16_t pos;
|
||||||
int16_t speed;
|
int32_t speed;
|
||||||
int16_t ramp_to_speed;
|
int32_t ramp_to_speed;
|
||||||
uint32_t next_step;
|
uint32_t next_step;
|
||||||
} stepper_T;
|
} stepper_T;
|
||||||
|
|
||||||
|
#define STEPPER_SPEED_LIMIT 300
|
||||||
|
|
||||||
void Timer1_Init(void);
|
void Timer1_Init(void);
|
||||||
void stepper_gpio_init();
|
void stepper_gpio_init();
|
||||||
void do_steps();
|
void do_steps();
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -22,7 +22,7 @@ TARGET = Parafraktor
|
|||||||
# debug build?
|
# debug build?
|
||||||
DEBUG = 1
|
DEBUG = 1
|
||||||
# optimization
|
# optimization
|
||||||
OPT = -Og
|
OPT = -O0
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
| | | 006 - 126 | Forward Rotation fast -> slow |
|
| | | 006 - 126 | Forward Rotation fast -> slow |
|
||||||
| | | 127 - 128 | Stop |
|
| | | 127 - 128 | Stop |
|
||||||
| | | 129 - 255 | Backward Rotation slow -> fast |
|
| | | 129 - 255 | Backward Rotation slow -> fast |
|
||||||
| 31 | Auto Mode | 000 - 004 | No function |
|
| 36 | Auto Mode | 000 - 004 | No function |
|
||||||
| | | 005 - 010 | Go to Reference |
|
| | | 005 - 010 | Go to Reference |
|
||||||
| | | 015 - 020 | Classic Mode |
|
| | | 015 - 020 | Classic Mode |
|
||||||
|
|
||||||
@@ -22,4 +22,4 @@
|
|||||||
- BIGTREETECH Manta M8P
|
- BIGTREETECH Manta M8P
|
||||||
- https://github.com/bigtreetech/Manta-M8P/tree/master/V1.0_V1.1/Hardware
|
- https://github.com/bigtreetech/Manta-M8P/tree/master/V1.0_V1.1/Hardware
|
||||||
- https://github.com/bigtreetech/Manta-M8P
|
- https://github.com/bigtreetech/Manta-M8P
|
||||||
- https://bttwiki.com/M8P.html#product-profile
|
- https://bttwiki.com/M8P.html#product-profile
|
||||||
|
|||||||
@@ -6,9 +6,11 @@
|
|||||||
|
|
||||||
#include "SEGGER_SYSVIEW.h"
|
#include "SEGGER_SYSVIEW.h"
|
||||||
#include "uart_dmx.h"
|
#include "uart_dmx.h"
|
||||||
|
#include "mapping_table.h"
|
||||||
|
|
||||||
stepper_T steppers[] = {
|
stepper_T steppers[] = {
|
||||||
{.en_port=GPIOC, .en_pin=11, .dir_port=GPIOB, .dir_pin=4, .step_port=GPIOE, .step_pin=2, .home_port=GPIOF, .home_pin=3}
|
{.en_port=GPIOC, .en_pin=11, .dir_port=GPIOB, .dir_pin=4, .step_port=GPIOE, .step_pin=2, .home_port=GPIOF, .home_pin=3},
|
||||||
|
{.en_port=GPIOB, .en_pin=3, .dir_port=GPIOF, .dir_pin=11, .step_port=GPIOF, .step_pin=12, .home_port=GPIOF, .home_pin=4}
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_pins(stepper_T* stp){
|
void set_pins(stepper_T* stp){
|
||||||
@@ -42,6 +44,9 @@ void stepper_gpio_init(){
|
|||||||
for(uint8_t i=0; i<(sizeof(steppers)/sizeof(stepper_T)); i++){
|
for(uint8_t i=0; i<(sizeof(steppers)/sizeof(stepper_T)); i++){
|
||||||
set_pins(&steppers[i]);
|
set_pins(&steppers[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
steppers[0].homed = 1;
|
||||||
|
steppers[1].homed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer1_Init(void) {
|
void Timer1_Init(void) {
|
||||||
@@ -88,10 +93,10 @@ void do_steps(){
|
|||||||
steppers[i].speed--;
|
steppers[i].speed--;
|
||||||
|
|
||||||
/* limit max speed */
|
/* limit max speed */
|
||||||
if(steppers[i].speed >= 100)
|
if(steppers[i].speed >= STEPPER_SPEED_LIMIT)
|
||||||
steppers[i].speed=100;
|
steppers[i].speed=STEPPER_SPEED_LIMIT;
|
||||||
if(steppers[i].speed <= -100)
|
if(steppers[i].speed <= -STEPPER_SPEED_LIMIT)
|
||||||
steppers[i].speed=-100;
|
steppers[i].speed=-STEPPER_SPEED_LIMIT;
|
||||||
|
|
||||||
/* get direction from sign */
|
/* get direction from sign */
|
||||||
if(steppers[i].speed>0)
|
if(steppers[i].speed>0)
|
||||||
@@ -127,7 +132,8 @@ void do_steps(){
|
|||||||
if(steppers[i].homed){
|
if(steppers[i].homed){
|
||||||
static uint16_t old_ramp_to_speed;
|
static uint16_t old_ramp_to_speed;
|
||||||
old_ramp_to_speed = steppers[i].ramp_to_speed;
|
old_ramp_to_speed = steppers[i].ramp_to_speed;
|
||||||
steppers[i].ramp_to_speed = rxBuffer[1] - steppers[i].pos;
|
motor_mapping_T* tmp = &(((fixture_mapping_T*)&rxBuffer[1])->channels[i]);
|
||||||
|
steppers[i].ramp_to_speed = tmp->tilt - steppers[i].pos;
|
||||||
|
|
||||||
if(old_ramp_to_speed == 0 && steppers[i].ramp_to_speed != 0)
|
if(old_ramp_to_speed == 0 && steppers[i].ramp_to_speed != 0)
|
||||||
steppers[i].trigger_step = 1;
|
steppers[i].trigger_step = 1;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
-IDrivers/SystemView/Config
|
-IDrivers/SystemView/Config
|
||||||
-IDrivers/SystemView/SEGGER
|
-IDrivers/SystemView/SEGGER
|
||||||
-IDrivers/SystemView/SYSVIEW
|
-IDrivers/SystemView/SYSVIEW
|
||||||
-Og
|
-O0
|
||||||
-Wall
|
-Wall
|
||||||
-fdata-sections
|
-fdata-sections
|
||||||
-ffunction-sections
|
-ffunction-sections
|
||||||
|
|||||||
Reference in New Issue
Block a user