Skip to content

Commit

Permalink
reduced calls to IO HAL in stepgen
Browse files Browse the repository at this point in the history
- reduced calls to IO HAL in stepgen
- fixed 74hc595 io call implicit declaration warnings
  • Loading branch information
Paciente8159 committed Aug 16, 2023
1 parent 8b8632f commit d72f7fa
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion uCNC/src/cnc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ extern "C"
#include "utils.h"
// extension modules
#include "module.h"
#include "hal/io_hal.h"
#include "interface/defaults.h"
#include "interface/grbl_interface.h"
#include "interface/settings.h"
#include "interface/serial.h"
#include "interface/protocol.h"
#include "core/io_control.h"
#include "core/io_control.h"
#include "core/parser.h"
#include "core/motion_control.h"
#include "core/planner.h"
Expand Down
2 changes: 1 addition & 1 deletion uCNC/src/core/interpolator.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ MCU_CALLBACK void mcu_step_cb(void)
// loads a new segment
itp_rt_sgm = &itp_sgm_data[itp_sgm_data_read];
cnc_set_exec_state(EXEC_RUN);
if (itp_rt_sgm->block != NULL)
if (itp_rt_sgm->remaining_steps)
{
#if (DSS_MAX_OVERSAMPLING != 0)
if (itp_rt_sgm->next_dss != 0)
Expand Down
4 changes: 4 additions & 0 deletions uCNC/src/core/io_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,10 @@ void io_toggle_steps(uint8_t mask)
// #ifdef ENABLE_IO_MODULES
// EVENT_INVOKE(toggle_steps, &mask);
// #endif
if (!mask)
{
return;
}

#ifdef IC74HC595_HAS_STEPS
ic74hc595_toggle_steps(mask);
Expand Down
2 changes: 1 addition & 1 deletion uCNC/src/core/io_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern "C"
#endif

#include "../module.h"
#include "../modules/ic74hc595.h"
// #include "../modules/ic74hc595.h"
#include "../hal/io_hal.h"
#include <stdint.h>
#include <stdbool.h>
Expand Down
6 changes: 6 additions & 0 deletions uCNC/src/hal/io_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ extern "C"
{
#endif

#include "../modules/ic74hc595.h"

/*IO HAL*/
#if ASSERT_PIN_IO(STEP0)
#define io1_config_output mcu_config_output(STEP0)
Expand Down Expand Up @@ -4770,6 +4772,10 @@ extern "C"
#endif

/*PWM*/
extern uint8_t g_soft_pwm_res;
extern uint8_t g_io_soft_pwm[16];
extern uint8_t mcu_softpwm_freq_config(uint16_t freq);

#if ASSERT_PIN_IO(PWM0)
#define io25_config_pwm(freq) mcu_config_pwm(PWM0, freq)
#define io25_set_pwm(value) mcu_set_pwm(PWM0, value)
Expand Down
3 changes: 0 additions & 3 deletions uCNC/src/hal/mcus/esp32/mcumap_esp32.h
Original file line number Diff line number Diff line change
Expand Up @@ -2833,9 +2833,6 @@ extern "C"
__indirect__(X, OUTREG)->OUT ^= (1UL << (0x1F & __indirect__(X, BIT))); \
}

#ifdef IC74HC595_HAS_PWMS
extern uint8_t mcu_softpwm_freq_config(uint16_t freq);
#endif
#define mcu_config_pwm(X, Y) \
{ \
ledc_timer_config_t pwmtimer = {0}; \
Expand Down

0 comments on commit d72f7fa

Please sign in to comment.