Fix ESP32 servos, platformio.ini, etc. (#14247)
This commit is contained in:
parent
a373d3f557
commit
9439fab7fd
6 changed files with 24 additions and 18 deletions
|
@ -193,6 +193,9 @@ void HAL_adc_start_conversion(uint8_t adc_pin) {
|
|||
}
|
||||
|
||||
void analogWrite(int pin, int value) {
|
||||
|
||||
if (!PWM_PIN(pin)) return;
|
||||
|
||||
static int cnt_channel = 1,
|
||||
pin_to_channel[40] = {};
|
||||
if (pin_to_channel[pin] == 0) {
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
|
||||
#include "HAL_Servo_ESP32.h"
|
||||
|
||||
int Servo::channel_next_free = 0;
|
||||
// Adjacent channels (0/1, 2/3 etc.) share the same timer and therefore the same frequency and resolution settings on ESP32,
|
||||
// so we only allocate servo channels up high to avoid side effects with regards to analogWrite (fans, leds, laser pwm etc.)
|
||||
int Servo::channel_next_free = 12;
|
||||
|
||||
Servo::Servo() {
|
||||
this->channel = channel_next_free++;
|
||||
|
@ -42,7 +44,7 @@ int8_t Servo::attach(const int pin) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void Servo::detach() { ledcDetachPin(this->pin) }
|
||||
void Servo::detach() { ledcDetachPin(this->pin); }
|
||||
|
||||
int Servo::read() { return this->degrees; }
|
||||
|
||||
|
|
|
@ -21,10 +21,11 @@
|
|||
*/
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
#include "i2s.h"
|
||||
|
||||
#include "../shared/Marduino.h"
|
||||
#include "../../core/macros.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "rom/lldesc.h"
|
||||
#include "soc/i2s_struct.h"
|
||||
|
|
|
@ -33,9 +33,3 @@ uint8_t i2s_state(uint8_t pin);
|
|||
void i2s_write(uint8_t pin, uint8_t val);
|
||||
|
||||
void i2s_push_sample();
|
||||
|
||||
// pin definitions
|
||||
|
||||
#define I2S_WS 25
|
||||
#define I2S_BCK 26
|
||||
#define I2S_DATA 27
|
||||
|
|
|
@ -30,18 +30,24 @@
|
|||
|
||||
#define BOARD_NAME "Espressif ESP32"
|
||||
|
||||
//
|
||||
// I2S (steppers & other output-only pins)
|
||||
//
|
||||
#define I2S_STEPPER_STREAM
|
||||
#define I2S_WS 25
|
||||
#define I2S_BCK 26
|
||||
#define I2S_DATA 27
|
||||
|
||||
//
|
||||
// Limit Switches
|
||||
//
|
||||
#define X_MIN_PIN 34
|
||||
#define Y_MIN_PIN 35
|
||||
#define Z_MIN_PIN 15
|
||||
#define X_MIN_PIN 34
|
||||
#define Y_MIN_PIN 35
|
||||
#define Z_MIN_PIN 15
|
||||
|
||||
//
|
||||
// Steppers
|
||||
//
|
||||
#define I2S_STEPPER_STREAM
|
||||
|
||||
#define X_STEP_PIN 128
|
||||
#define X_DIR_PIN 129
|
||||
#define X_ENABLE_PIN 130
|
||||
|
|
|
@ -403,10 +403,10 @@ lib_ignore =
|
|||
# Espressif ESP32
|
||||
#
|
||||
[env:esp32]
|
||||
platform = https://github.com/platformio/platform-espressif32.git ; #feature/stage
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
upload_speed = 115200
|
||||
platform = espressif32
|
||||
board = esp32dev
|
||||
framework = arduino
|
||||
upload_speed = 115200
|
||||
monitor_speed = 115200
|
||||
upload_port = /dev/ttyUSB0
|
||||
lib_deps =
|
||||
|
|
Reference in a new issue