Skip to content
Snippets Groups Projects
Commit ef824cd7 authored by Jake Read's avatar Jake Read
Browse files

blocks work, ready to implement block ringbuffer

parent ac5971ce
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,7 @@ Sheet="1"
Type="Board Editor"
Number=2
File="mkstepper.brd"
View="0.139397 10.9565 61.2024 56.4519"
View="-11.172 -7.65215 62.1037 46.9423"
WireWidths=" 0.0762 0.1016 0.127 0.15 0.2 0.2032 0.254 0.3048 0.4064 0.508 0.6096 0.8128 1.016 1.27 2.54 0.1524"
PadDiameters=" 0.254 0.3048 0.4064 0.6096 0.8128 1.016 1.27 1.4224 1.6764 1.778 1.9304 2.1844 2.54 3.81 6.4516 0"
PadDrills=" 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.65 0.7 0.75 0.8 0.85 0.9 1 0.6"
......@@ -131,7 +131,7 @@ Type="Control Panel"
Number=0
[Desktop]
Screen="3840 1080"
Screen="1920 1080"
Window="Win_1"
Window="Win_2"
Window="Win_3"
......@@ -20,11 +20,14 @@ stepper_t stepper_new(pin_t *step_pin, pin_t *dir_pin){
}
void stepper_reset(stepper_t *stepper){
stepper->one_minute = 160980000; // calib'd # for timer ticks per minute (speeds, accels all in steps/min or steps/min/s)
stepper->speed_period = 0;
stepper->accel_period = 0;
stepper->blockhead = 0;
stepper->blocktail = 0;
stepper->blocksize = BLOCKS_QUEUE_SIZE;
stepper->speed = 0;
stepper->last_step = 0;
......
......@@ -12,10 +12,34 @@
#include "sam.h"
#include "pin.h"
#define BLOCKS_QUEUE_SIZE 64
// one movement
typedef struct {
// from whence you came
uint8_t return_address[8]; // C quesion: how to do this properly with malloc() ? malloc() on embedded sys?
uint8_t return_address_length;
// for what you do
uint8_t dir; // 0 or 1
uint32_t length; // in steps
uint32_t entry_speed;
uint32_t accel;
uint32_t position_accel_to;
uint32_t position_deccel_from;
}block_t;
// the stepper
typedef struct {
pin_t *step_pin;
pin_t *dir_pin;
// block ringbuffer
block_t block[BLOCKS_QUEUE_SIZE];
uint8_t blockhead;
uint8_t blocktail;
uint8_t blocksize;
// tracking time periods
unsigned long one_minute;
unsigned long speed_period;
......@@ -49,11 +73,7 @@ void stepper_update(stepper_t *stepper);
/*
step to-do
- everything is broken and untested
- refactor all for:
- dir-by-flag, assume no dir change per segment
- speed & periods unfuck
- update checks accel rate as well
// block ringbuffer, pull and reply blocks - architecture for network functions, generally?
*/
#endif /* STEPPER_H_ */
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment