Skip to content

Commit

Permalink
Merge pull request #584 from Paciente8159/esp32-i2s-dma
Browse files Browse the repository at this point in the history
ESP32 I2S using buffered motion over DMA
  • Loading branch information
Paciente8159 authored Feb 3, 2024
2 parents 815431d + 6d28cbf commit ded7efc
Show file tree
Hide file tree
Showing 12 changed files with 783 additions and 2,278 deletions.
Binary file modified docs/mcumap_gen.xlsx
Binary file not shown.
1,982 changes: 3 additions & 1,979 deletions sdkconfig.defaults

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions uCNC/src/core/interpolator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1368,3 +1368,10 @@ void itp_start(bool is_synched)
}
}
}

itp_segment_t *itp_get_rt_segment()
{
return (itp_sgm_is_empty()) ? NULL : &itp_sgm_data[itp_sgm_data_read];
}

uint8_t __attribute__((weak)) itp_set_step_mode(uint8_t mode) {return 0;}
7 changes: 7 additions & 0 deletions uCNC/src/core/interpolator.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ extern "C"
#define ITP_SYNC 32
#define ITP_BACKLASH 64

#define ITP_STEP_MODE_STARTUP 0
#define ITP_STEP_MODE_DEFAULT 1
#define ITP_STEP_MODE_REALTIME 2
#define ITP_STEP_MODE_SYNC 4

// contains data of the block being executed by the pulse routine
// this block has the necessary data to execute the Bresenham line algorithm
typedef struct itp_blk_
Expand Down Expand Up @@ -90,6 +95,8 @@ extern "C"
float itp_get_rt_feed(void);
bool itp_is_empty(void);
uint8_t itp_sync(void);
itp_segment_t* itp_get_rt_segment();
uint8_t itp_set_step_mode(uint8_t mode);

void itp_sync_spindle(void);
void itp_start(bool is_synched);
Expand Down
8 changes: 8 additions & 0 deletions uCNC/src/core/motion_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ bool mc_toogle_checkmode(void)
return mc_checkmode;
}

static void FORCEINLINE mc_restore_step_mode(uint8_t *mode)
{
itp_set_step_mode(*mode);
}

static uint8_t mc_line_segment(int32_t *step_new_pos, motion_data_t *block_data)
{
// resets accumulator vars of the block
Expand Down Expand Up @@ -728,6 +733,8 @@ uint8_t mc_home_axis(uint8_t axis_mask, uint8_t axis_limit)
float target[AXIS_COUNT];
motion_data_t block_data = {0};
uint8_t limits_flags;
uint8_t restore_step_mode __attribute__((__cleanup__(mc_restore_step_mode))) = itp_set_step_mode(ITP_STEP_MODE_REALTIME);

#ifdef ENABLE_MOTION_CONTROL_MODULES
homing_status_t homing_status __attribute__((__cleanup__(mc_home_axis_finalize))) = {axis_mask, axis_limit, STATUS_OK};
#endif
Expand Down Expand Up @@ -885,6 +892,7 @@ uint8_t mc_home_axis(uint8_t axis_mask, uint8_t axis_limit)
uint8_t mc_probe(float *target, uint8_t flags, motion_data_t *block_data)
{
#if ASSERT_PIN(PROBE)
uint8_t restore_step_mode __attribute__((__cleanup__(mc_restore_step_mode))) = itp_set_step_mode(ITP_STEP_MODE_REALTIME);
#ifdef ENABLE_G39_H_MAPPING
// disable hmap for probing motion
block_data->motion_mode &= ~MOTIONCONTROL_MODE_APPLY_HMAP;
Expand Down
3 changes: 2 additions & 1 deletion uCNC/src/core/motion_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ extern "C"
} motion_data_t;

#ifdef ENABLE_MOTION_CONTROL_MODULES
typedef struct homing_status_ {
typedef struct homing_status_
{
uint8_t axis;
uint8_t axis_limit;
uint8_t status;
Expand Down
1 change: 1 addition & 0 deletions uCNC/src/hal/boards/esp32/esp32.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ board_build.partitions = min_spiffs.csv
monitor_filters=esp32_exception_decoder
upload_speed = 921600
lib_deps = SPI, Wire, Wifi, WebServer, HTTPUpdatedServer, BluetoothSerial
debug_tool=esp-prog

##################
# Arduino builds #
Expand Down
Loading

0 comments on commit ded7efc

Please sign in to comment.