mirror of
https://github.com/synthetos/g2.git
synced 2026-09-23 12:14:09 +08:00
Removing F_CPU and all uses of it.
It’s not longer accurate and mostly unused. It’s use by PWM was inaccurate.
This commit is contained in:
@@ -82,8 +82,6 @@ using Motate::OutputPin;
|
||||
* Global System Defines *
|
||||
*************************/
|
||||
|
||||
#undef F_CPU // CPU clock - set for delays
|
||||
#define F_CPU 84000000UL
|
||||
#define MILLISECONDS_PER_TICK 1 // MS for system tick (systick * N)
|
||||
#define SYS_ID_DIGITS 12 // actual digits in system ID (up to 16)
|
||||
#define SYS_ID_LEN 16 // total length including dashes and NUL
|
||||
|
||||
@@ -84,8 +84,6 @@ using Motate::OutputPin;
|
||||
* Global System Defines *
|
||||
*************************/
|
||||
|
||||
#undef F_CPU // CPU clock - set for delays
|
||||
#define F_CPU 84000000UL
|
||||
#define MILLISECONDS_PER_TICK 1 // MS for system tick (systick * N)
|
||||
#define SYS_ID_DIGITS 12 // actual digits in system ID (up to 16)
|
||||
#define SYS_ID_LEN 16 // total length including dashes and NUL
|
||||
|
||||
@@ -84,8 +84,6 @@ using Motate::OutputPin;
|
||||
* Global System Defines *
|
||||
*************************/
|
||||
|
||||
#undef F_CPU // CPU clock - set for delays
|
||||
#define F_CPU 84000000UL
|
||||
#define MILLISECONDS_PER_TICK 1 // MS for system tick (systick * N)
|
||||
#define SYS_ID_DIGITS 12 // actual digits in system ID (up to 16)
|
||||
#define SYS_ID_LEN 16 // total length including dashes and NUL
|
||||
|
||||
@@ -85,8 +85,6 @@ using Motate::OutputPin;
|
||||
* Global System Defines *
|
||||
*************************/
|
||||
|
||||
#undef F_CPU // CPU clock - set for delays
|
||||
#define F_CPU 84000000UL
|
||||
#define MILLISECONDS_PER_TICK 1 // MS for system tick (systick * N)
|
||||
#define SYS_ID_DIGITS 12 // actual digits in system ID (up to 16)
|
||||
#define SYS_ID_LEN 16 // total length including dashes and NUL
|
||||
|
||||
@@ -83,8 +83,6 @@ using Motate::OutputPin;
|
||||
* Global System Defines *
|
||||
*************************/
|
||||
|
||||
#undef F_CPU // CPU clock - set for delays
|
||||
#define F_CPU 84000000UL
|
||||
#define MILLISECONDS_PER_TICK 1 // MS for system tick (systick * N)
|
||||
#define SYS_ID_DIGITS 12 // actual digits in system ID (up to 16)
|
||||
#define SYS_ID_LEN 16 // total length including dashes and NUL
|
||||
|
||||
@@ -82,8 +82,6 @@ using Motate::OutputPin;
|
||||
* Global System Defines *
|
||||
*************************/
|
||||
|
||||
#undef F_CPU // CPU clock - set for delays
|
||||
#define F_CPU 84000000UL
|
||||
#define MILLISECONDS_PER_TICK 1 // MS for system tick (systick * N)
|
||||
#define SYS_ID_DIGITS 12 // actual digits in system ID (up to 16)
|
||||
#define SYS_ID_LEN 16 // total length including dashes and NUL
|
||||
|
||||
@@ -82,8 +82,6 @@ using Motate::OutputPin;
|
||||
* Global System Defines *
|
||||
*************************/
|
||||
|
||||
#undef F_CPU // CPU clock - set for delays
|
||||
#define F_CPU 84000000UL
|
||||
#define MILLISECONDS_PER_TICK 1 // MS for system tick (systick * N)
|
||||
#define SYS_ID_DIGITS 12 // actual digits in system ID (up to 16)
|
||||
#define SYS_ID_LEN 16 // total length including dashes and NUL
|
||||
|
||||
+4
-4
@@ -45,8 +45,8 @@ static Motate::PWMOutputPin<Motate::kSpindle_Pwm2PinNumber> secondary_pwm_pin;
|
||||
//#define PWM_TIMER_TYPE TC1_struct // PWM uses TC1's
|
||||
#define PWM_TIMER_t TC1_t // PWM uses TC1's
|
||||
#define PWM_TIMER_DISABLE 0 // turn timer off (clock = 0 Hz)
|
||||
#define PWM_MAX_FREQ (F_CPU/256) // max frequency with 8-bits duty cycle precision
|
||||
#define PWM_MIN_FREQ (F_CPU/64/65536) // min frequency with supported prescaling
|
||||
//#define PWM_MAX_FREQ (F_CPU/256) // max frequency with 8-bits duty cycle precision
|
||||
//#define PWM_MIN_FREQ (F_CPU/64/65536) // min frequency with supported prescaling
|
||||
|
||||
// channel specific defines
|
||||
/* CLKSEL is used to configure default PWM clock operating ranges
|
||||
@@ -95,8 +95,8 @@ void pwm_init() {}
|
||||
stat_t pwm_set_freq(uint8_t chan, float freq)
|
||||
{
|
||||
if (chan > PWMS) { return (STAT_NO_SUCH_DEVICE);}
|
||||
if (freq < PWM_MIN_FREQ) { return (STAT_INPUT_LESS_THAN_MIN_VALUE);}
|
||||
if (freq > PWM_MAX_FREQ) { return (STAT_INPUT_EXCEEDS_MAX_VALUE);}
|
||||
//if (freq < PWM_MIN_FREQ) { return (STAT_INPUT_LESS_THAN_MIN_VALUE);}
|
||||
//if (freq > PWM_MAX_FREQ) { return (STAT_INPUT_EXCEEDS_MAX_VALUE);}
|
||||
|
||||
if (chan == PWM_1) {
|
||||
spindle_pwm_pin.setFrequency(freq);
|
||||
|
||||
+3
-3
@@ -51,7 +51,7 @@ static stRunSingleton_t st_run;
|
||||
static void _load_move(void);
|
||||
|
||||
// handy macro
|
||||
#define _f_to_period(f) (uint16_t)((float)F_CPU / (float)f)
|
||||
//#define _f_to_period(f) (uint16_t)((float)F_CPU / (float)f)
|
||||
|
||||
/**** Setup motate ****/
|
||||
|
||||
@@ -658,7 +658,7 @@ stat_t st_prep_line(float travel_steps[], float following_error[], float segment
|
||||
// - dda_ticks is the integer number of DDA clock ticks needed to play out the segment
|
||||
// - ticks_X_substeps is the maximum depth of the DDA accumulator (as a negative number)
|
||||
|
||||
st_pre.dda_period = _f_to_period(FREQUENCY_DDA); // FYI: this is a constant
|
||||
//st_pre.dda_period = _f_to_period(FREQUENCY_DDA); // FYI: this is a constant
|
||||
st_pre.dda_ticks = (int32_t)(segment_time * 60 * FREQUENCY_DDA);// NB: converts minutes to seconds
|
||||
st_pre.dda_ticks_X_substeps = st_pre.dda_ticks * DDA_SUBSTEPS;
|
||||
|
||||
@@ -753,7 +753,7 @@ void st_prep_command(void *bf)
|
||||
void st_prep_dwell(float microseconds)
|
||||
{
|
||||
st_pre.block_type = BLOCK_TYPE_DWELL;
|
||||
st_pre.dda_period = _f_to_period(FREQUENCY_DWELL);
|
||||
//st_pre.dda_period = _f_to_period(FREQUENCY_DWELL);
|
||||
st_pre.dda_ticks = (uint32_t)((microseconds/1000000) * FREQUENCY_DWELL);
|
||||
st_pre.buffer_state = PREP_BUFFER_OWNED_BY_LOADER; // signal that prep buffer is ready
|
||||
}
|
||||
|
||||
+1
-1
@@ -413,7 +413,7 @@ typedef struct stPrepSingleton {
|
||||
struct mpBuffer *bf; // static pointer to relevant buffer
|
||||
blockType block_type; // move type (requires planner.h)
|
||||
|
||||
uint16_t dda_period; // DDA or dwell clock period setting
|
||||
//uint16_t dda_period; // DDA or dwell clock period setting (No longer used)
|
||||
uint32_t dda_ticks; // DDA or dwell ticks for the move
|
||||
uint32_t dda_ticks_X_substeps; // DDA ticks scaled by substep factor
|
||||
stPrepMotor_t mot[MOTORS]; // prep time motor structs
|
||||
|
||||
Reference in New Issue
Block a user