Comments (16)
Going to add a little follow-up here because I couldn't understand how it worked for some ESP32 users and not me. Well, the ESP32 updates are not in v1.4.1, and that is the most recent version available through library managers in Arduino IDE and PlatformIO.
I manually updated direct_pin_read.h and interrupt_pins.h from the head of this repo (utility folder) and now it compiles happily.
Brilliant work @PaulStoffregen, thank you to @lumostor and @aster94 for the ESP32 fixes!
from encoder.
I am also running into this problem. I can only get it to work by entering this dependancy in my platformio.ini: lib_deps = https://github.com/PaulStoffregen/Encoder.git
This will install version #34ea332
of the library and this works without any problems.
If I enter lib_deps = Encoder
, the latest version #4c4ec3a
of the library gets installed and this will produce the errors again. Can someone explain this?
from encoder.
The version of encoder library from the arduino IDE and platformio is 1.4.1 (commit c23bd40) which is prior ESP32 addition. You should install from github.
from encoder.
I am also using platformIO and it doesn't work for esp32dev with newest github version of this lib.
.pio/build/esp32dev/src/myEncoder.cpp.o: In function Encoder::isr39()': /home/.../src/myEncoder.cpp:161:(.iram1.41[Encoder::isr39()]+0x3): dangerous relocation: l32r: literal placed after use: .literal._ZN7Encoder5isr16Ev /home/.../src/myEncoder.cpp:161:(.iram1.41[Encoder::isr39()]+0x9): dangerous relocation: l32r: literal placed after use: (.literal._ZN7Encoder5isr16Ev+0x4) .pio/build/esp32dev/src/myEncoder.cpp.o: In function
Encoder::isr36()':
/home/.../src/myEncoder.cpp:161:(.iram1.40[Encoder::isr15()]+0x3): dangerous relocation: l32r: literal placed after use: .literal._ZN7Encoder5isr15Ev
/home/.../src/myEncoder.cpp:161:(.iram1.40[Encoder::isr15()]+0x9): dangerous relocation: l32r: literal placed after use: (.literal._ZN7Encoder5isr15Ev+0x4)
.pio/build/esp32dev/src/myEncoder.cpp.o: In function `Encoder::isr35()':
here Messages of isr35() to isr32(), isr27() to isr25(), isr23() to isr12(), isr5() to isr0()(below)
.pio/build/esp32dev/src/myEncoder.cpp.o: In function Encoder::isr1()': /home/.../src/myEncoder.cpp:161:(.iram1.17[Encoder::isr1()]+0x3): dangerous relocation: l32r: literal placed after use: .literal._ZN7Encoder4isr1Ev /home/.../src/myEncoder.cpp:161:(.iram1.17[Encoder::isr1()]+0x8): dangerous relocation: l32r: literal placed after use: (.literal._ZN7Encoder4isr1Ev+0x4) .pio/build/esp32dev/src/myEncoder.cpp.o: In function
Encoder::isr0()':
/home/.../src/myEncoder.cpp:161:(.iram1.16[Encoder::isr0()]+0x3): dangerous relocation: l32r: literal placed after use: .literal._ZN7Encoder4isr0Ev
/home/.../src/myEncoder.cpp:161:(.iram1.16[Encoder::isr0()]+0x8): dangerous relocation: l32r: literal placed after use: (.literal._ZN7Encoder4isr0Ev+0x4)
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1
Can someone help?
from encoder.
I do not use ESP. I'm depending on the ESP community to resolve problems and submit pull requests.
from encoder.
Ah. Okej. Hopefully someone who knows the esp32 code sees this and can give me a hint on how to solve it. :)
from encoder.
I had also trouble to compile the lib with my "nodemcu-32s" board. After looking at the source code, the ESP32 seems to be supported already.
The switch for the interrupts is done with by checking for a define of "ESP32". This define seems to be missing. After adding "#define ESP32" to my main.cpp the project compiles fine.
from encoder.
I'm depending on the ESP community to submit pull requests. If someone knows the proper way to conditionally compile for ESP32, please submit a pull request.
Again, I do not use or test with ESP32. This is free open source software. I'm depending on you, the ESP community, to send good quality pull requests.
from encoder.
I don't want to be a pain, but the esp32 is far from properly working. This will take time, as it took time for the esp8266, to become reliable.
from encoder.
I can confirm that this library works on an ESP32 (Lolin32 Lite) under Arduino IDE (with the Espressif core of course).
@ageir I see you are using PlatformIO. I've never used that IDE but suspect Espressif do not support it. I believe that is your trouble.
@fredericplante that has been true, especially six months ago but I'm finding that isn't really the case now (some edge cases of course), it's mostly generic libraries (or specific to AVR) and/or having not updated the Espressif core. Still, that isn't really on topic but thought I'd mention it in case other ESP32 users assume it's Paul's library or something.
from encoder.
Hi, also on my side I can confirm that this libray is working properly on WEMOS LOLIN32 ( based on ESP32) , with 2 encoders.
My dev. environment is VS2015 + VisualMicro, based on Arduino IDE toolchain.
The only issue I've found , but not caused by this great library , is that if I choose some pins (e.g. 0 and 2 for EncA and 7,6 for EncB, the program becomes instable (infinite reset with message "Guru Meditation Error: Core 0 panic'ed (IllegalInstruction))". This does not happen if i choose pin 36,25 and 26,11.
from encoder.
Tried and works on ESP32, but just on "No_interrupt" mode
from encoder.
does esp32 works with pi 3 as a sender?
from encoder.
I was having the same problem in a laptop but not in a desktop computer. Both with same Arduino IDE and Encoder library version. In laptop I installed the library with Arduino tool and in desktop I did it manually from this github repository, and that was the trick. After installed manually in laptop it compiled ok.
from encoder.
I am also using platformIO with no luck compiling for esp32dev.
In file included from .pio/libdeps/esp32dev/Encoder/Encoder.h:46:0,
from src/main.cpp:14:
.pio/libdeps/esp32dev/Encoder/utility/interrupt_pins.h:202:2: error: #error "Interrupts are unknown for this board, please add to this code"
#error "Interrupts are unknown for this board, please add to this code"
^
.pio/libdeps/esp32dev/Encoder/utility/interrupt_pins.h:205:2: error: #error "Encoder requires interrupt pins, but this board does not have any :("
#error "Encoder requires interrupt pins, but this board does not have any :("
^
.pio/libdeps/esp32dev/Encoder/utility/interrupt_pins.h:206:2: error: #error "You could try defining ENCODER_DO_NOT_USE_INTERRUPTS as a kludge."
#error "You could try defining ENCODER_DO_NOT_USE_INTERRUPTS as a kludge."
works flawlessly if I compile for esp32 using arduino IDE. I dont know how to define the board in pins.h, im a newbie.
from encoder.
There are solution for "dangerous relocation: l32r: literal placed after use:" error which help me with Arduino IDE. I changed -ffunction-sections to -mtext-section-literals in C:\Users*****\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\platform.txt file, in compiler.c.cmd=xtensa-esp32-elf-gcc and compiler.cpp.cmd=xtensa-esp32-elf-g++ paragraphs. After changes two knobs encoder example compiles normal.
from encoder.
Related Issues (20)
- Double counting pulse HOT 1
- ATMEGA 168P add interrupt pins mapping to interrupt_pins.h
- Can I use this library with esp32?
- [ Feature Request ] : Seeeduino XIAO : support hardware interrupts
- Error trying to build SpeedTest.ino on Teensy 4.1 in Arduino 1.8.19: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile unsigned char*' in initialization
- No support for Arduino nano rp2040 connect HOT 4
- STM32H743ZI2 144 Nucleo compatibility issues HOT 1
- Raspberry Pico (RP2040) support? HOT 6
- RP Pico RP2040 ConfigurableFirmata Encoder Interrupts not working HOT 4
- Amazing library! Is there an example Windows serial interface anywhere?
- undercounting steps only in one direction, only when going slowly, with a linear encoder
- Internal pull-up HOT 3
- library.properties Still Says Version 1.4.2 HOT 20
- Encoder causes esp32 to crash when using platformIO HOT 3
- Attaching interrupt to another pin while using ENCODER_OPTIMIZE_INTERRUPTS
- Interrupts are unknown for this board, please add to this code
- Feature: getDirection() HOT 2
- Raspberry pi pico RP2040 Not supported HOT 1
- Arduino UNO R4 MINIMA not supported HOT 4
- wrong counting backwards HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from encoder.