mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-30 01:30:05 +02:00
Simple speedup for spindle PWM
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
// Grbl versioning system
|
// Grbl versioning system
|
||||||
#define GRBL_VERSION "1.1f"
|
#define GRBL_VERSION "1.1f"
|
||||||
#define GRBL_VERSION_BUILD "20200218"
|
#define GRBL_VERSION_BUILD "20200219"
|
||||||
|
|
||||||
//#include <sdkconfig.h>
|
//#include <sdkconfig.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
@@ -205,8 +205,14 @@ void spindle_sync(uint8_t state, float rpm)
|
|||||||
|
|
||||||
void grbl_analogWrite(uint8_t chan, uint32_t duty)
|
void grbl_analogWrite(uint8_t chan, uint32_t duty)
|
||||||
{
|
{
|
||||||
if (ledcRead(chan) != duty) // reduce unnecessary calls to ledcWrite()
|
// Remember the old duty cycle in memory instead of reading
|
||||||
|
// it from the I/O peripheral because I/O reads are quite
|
||||||
|
// a bit slower than memory reads.
|
||||||
|
static uint32_t old_duty = 0;
|
||||||
|
|
||||||
|
if (old_duty != duty) // reduce unnecessary calls to ledcWrite()
|
||||||
{
|
{
|
||||||
|
old_duty = duty;
|
||||||
ledcWrite(chan, duty);
|
ledcWrite(chan, duty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user