Browse Source

fix interfering channels (2/2)

main
Hendrik Langer 7 years ago
parent
commit
fe5c146968
  1. 5
      software/src/pusher.cpp
  2. 2
      software/src/pusher.h

5
software/src/pusher.cpp

@ -13,7 +13,6 @@ Pusher::Pusher(void) {
} }
void Pusher::setup(void) { void Pusher::setup(void) {
int channel = 13; // LEDC_CHANNEL_3 // beware: some channels interfere with the rmt peripheral used by FastLED
ledcSetup(channel, 50, TIMER_WIDTH); ledcSetup(channel, 50, TIMER_WIDTH);
for(int pin : SERVO_PINS) { for(int pin : SERVO_PINS) {
if (xSemaphoreTake(xSemaphore, TIMEOUT) == pdTRUE) { if (xSemaphoreTake(xSemaphore, TIMEOUT) == pdTRUE) {
@ -30,11 +29,7 @@ void Pusher::setup(void) {
void Pusher::push(int num) { void Pusher::push(int num) {
if (xSemaphoreTake(xSemaphore, TIMEOUT) == pdTRUE) { if (xSemaphoreTake(xSemaphore, TIMEOUT) == pdTRUE) {
int channel = 1;
int pin = SERVO_PINS[num]; int pin = SERVO_PINS[num];
if (channel >= LEDC_NUM_CHANNELS) {
return;
}
// ledcSetup(channel, 50, TIMER_WIDTH); // ledcSetup(channel, 50, TIMER_WIDTH);
ledcAttachPin(pin, channel); ledcAttachPin(pin, channel);
ledcWrite(channel, MIN_PULSE_WIDTH); ledcWrite(channel, MIN_PULSE_WIDTH);

2
software/src/pusher.h

@ -18,6 +18,8 @@ static constexpr uint8_t PROGMEM LEDC_NUM_CHANNELS = 8; // default pulse width
static constexpr TickType_t PROGMEM TIMEOUT = portMAX_DELAY; static constexpr TickType_t PROGMEM TIMEOUT = portMAX_DELAY;
static constexpr uint8_t PROGMEM channel = 13; // LEDC_CHANNEL_3 // beware: some channels interfere with the rmt peripheral used by FastLED
class Pusher { class Pusher {
public: public:
Pusher(void); Pusher(void);

Loading…
Cancel
Save