Code Monkey home page Code Monkey logo

Comments (16)

euphy avatar euphy commented on June 27, 2024 5

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.

willemx avatar willemx commented on June 27, 2024 2

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.

lumostor avatar lumostor commented on June 27, 2024 2

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.

goldeng0d avatar goldeng0d commented on June 27, 2024 1

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.

PaulStoffregen avatar PaulStoffregen commented on June 27, 2024

I do not use ESP. I'm depending on the ESP community to resolve problems and submit pull requests.

from encoder.

ageir avatar ageir commented on June 27, 2024

Ah. Okej. Hopefully someone who knows the esp32 code sees this and can give me a hint on how to solve it. :)

from encoder.

Flos avatar Flos commented on June 27, 2024

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.

PaulStoffregen avatar PaulStoffregen commented on June 27, 2024

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.

fredericplante avatar fredericplante commented on June 27, 2024

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.

Jim-McDonald avatar Jim-McDonald commented on June 27, 2024

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.

Luke1962 avatar Luke1962 commented on June 27, 2024

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.

Zefram88 avatar Zefram88 commented on June 27, 2024

Tried and works on ESP32, but just on "No_interrupt" mode

from encoder.

majd47 avatar majd47 commented on June 27, 2024

does esp32 works with pi 3 as a sender?

from encoder.

fercapa avatar fercapa commented on June 27, 2024

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.

leckietech avatar leckietech commented on June 27, 2024

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.

RGeorge10 avatar RGeorge10 commented on June 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.