Replies: 16 comments 12 replies
-
Unfortunately Arduino uses the ESP32 compiler in gcc11 mode. You have two options: If you don't need the advanced callback interface you can simply comment line 4 in config.h #pragma once
// comment the following line out if you prefer plain vanilla function pointers for callbacks
#define WANT_MODERN_CALLBACKS
... With this, the library falls back to the legacy void(*void) callbacks which work with c++11 (I might make this the default for ESP32 in later versions) If you need the improved callback interface you need to change Hope that helps |
Beta Was this translation helpful? Give feedback.
-
Wait, I think I can fix that. I'll upload a test version later today |
Beta Was this translation helpful? Give feedback.
-
Can you try the code in the fix-esp-compile-issue branch? |
Beta Was this translation helpful? Give feedback.
-
Sure, I will try later today. Thanks for looking at it. On May 23, 2023 8:57 PM, luni64 ***@***.***> wrote:
Can you try the code in the fix-esp-compile-issue branch?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I got a successful build in Visual Micro. Thanks!!
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: ***@***.***>
Sent: Tuesday, May 23, 2023 8:57 PM
To: ***@***.***>
Cc: Joey ***@***.***>; ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Can you try the code in the fix-esp-compile-issue branch?
—
Reply to this email directly, view it on GitHub<#34 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVID5AUV2X3CVXRNOJTXHWBJFANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I spoke to soon. I have Bounce2 installed but in EncPlex74165.h it is not finding it. It is in my libraries directory. I am digging into find why.
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: ***@***.***>
Sent: Tuesday, May 23, 2023 8:57 PM
To: ***@***.***>
Cc: Joey ***@***.***>; ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Can you try the code in the fix-esp-compile-issue branch?
—
Reply to this email directly, view it on GitHub<#34 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVID5AUV2X3CVXRNOJTXHWBJFANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I had to turn Deep library search back on and it found it.
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: ***@***.***>
Sent: Tuesday, May 23, 2023 8:57 PM
To: ***@***.***>
Cc: Joey ***@***.***>; ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Can you try the code in the fix-esp-compile-issue branch?
—
Reply to this email directly, view it on GitHub<#34 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVID5AUV2X3CVXRNOJTXHWBJFANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
It is. I set deep search to false so the compile is quicker. Now that it found it, I can turn it back to false to speed up the compile. I do have a question for you. Everything I have read says to not multiple encoders. I will have 7 dual encoders which means I will need 28 pins and 7 more for push buttons. So multiplex sounds like the way to go. In your testing have you encountered any issues with multiplexing them. I will always only be using one at any time.
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: ***@***.***>
Sent: Wednesday, May 24, 2023 10:15 AM
To: ***@***.***>
Cc: Joey ***@***.***>; ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Can that be a VisualMicro issue? I tested using PlatformIO. Compiles nicely for UNO, XIAO, nano33 ESP32 and all Teensies.
—
Reply to this email directly, view it on GitHub<#34 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVKERDQD6WDCNWOOMJ3XHY64DANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Certainly will.
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: ***@***.***>
Sent: Wednesday, May 24, 2023 10:17 AM
To: ***@***.***>
Cc: Joey ***@***.***>; ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Great, can you let me know if you observe anything strange? I don't have an ESP32 lying around at the moment and don't want to push to the main branch before some testing.
—
Reply to this email directly, view it on GitHub<#34 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVNQHOKX7A3FINPDGNLXHY7BPANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Multiplexing works just fine if your processor is fast enough to read out all the encoders with a frequency of more than say 5kHz which should be no problem for an ESP32. I assume you saw the multiplexing page which introduces a few schemes: https://github.com/luni64/EncoderTool/tree/master/Resources/Extras? There are a few Teensy projects using a large number of multiplexed encoders for midi applications and didn't report any issue. I can look the posts up if you are interested. |
Beta Was this translation helpful? Give feedback.
-
No, not yet. Let me test here and see what kind of results I get. I REALLY rather multiplex than have 2 ESP32 running nothing but multiplexers and talking to each other. I have an Arduino Mega available but the ESP32 is faster. Just not enough pins.
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: ***@***.***>
Sent: Wednesday, May 24, 2023 10:34 AM
To: ***@***.***>
Cc: Joey ***@***.***>; ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Everything I have read says to not multiple encoders. I will have 7 dual encoders which means I will need 28 pins and 7 more for push buttons. So multiplex sounds like the way to go. In your testing have you encountered any issues with multiplexing them. I will always only be using one at any time.
Multiplexing works just fine if your processor is fast enough to read out all the encoders with a frequency of more than say 5kHz which should be no problem for an ESP32. I assume you saw the multiplexing page which introduces a few schemes: https://github.com/luni64/EncoderTool/tree/master/Resources/Extras? There are a few Teensy projects using a large number of multiplexed encoders for midi applications and didn't report any issue. I can look the posts up if you are interested.
—
Reply to this email directly, view it on GitHub<#34 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVLCKBQZTCB7JEDZFEDXHZBAZANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Got it connected but I am getting the following:
***@***.***
Here are my connections:
***@***.***
SIG_A is the 1st board and SIG_B is the 2nd board.
Any ideas?
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
From: ***@***.***>
Sent: Wednesday, May 24, 2023 10:34 AM
To: ***@***.***>
Cc: Joey ***@***.***>; ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Everything I have read says to not multiple encoders. I will have 7 dual encoders which means I will need 28 pins and 7 more for push buttons. So multiplex sounds like the way to go. In your testing have you encountered any issues with multiplexing them. I will always only be using one at any time.
Multiplexing works just fine if your processor is fast enough to read out all the encoders with a frequency of more than say 5kHz which should be no problem for an ESP32. I assume you saw the multiplexing page which introduces a few schemes: https://github.com/luni64/EncoderTool/tree/master/Resources/Extras? There are a few Teensy projects using a large number of multiplexed encoders for midi applications and didn't report any issue. I can look the posts up if you are interested.
—
Reply to this email directly, view it on GitHub<#34 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVLCKBQZTCB7JEDZFEDXHZBAZANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Your post is kind of incomplete? Probably some missing pictures? Did you email it? If so, might be better to post directly in GitHub |
Beta Was this translation helpful? Give feedback.
-
Thanks, I'll try how this code works here and if I can find anything strange over the weekend. (won't have much time today). What about the buttons? Do you intend to read them out via the EncoderTool as well? Here your code for easy reference: /*
Name: Encoder4067MplexTest.ino
Created: 5/22/2023 4:30:15 PM
Author: jpicinich
*/
#include "EncoderTool.h"
#include <vector>
using namespace EncoderTool;
using namespace std;
constexpr unsigned encoderCount = 2; // number of attached encoders
constexpr unsigned S0 = 18;
constexpr unsigned S1 = 19;
constexpr unsigned S2 = 22;
constexpr unsigned S3 = 23;
constexpr unsigned SIG_A = 16;
constexpr unsigned SIG_B = 17;
class SimEncoders : public EncPlex4067 {
vector<vector<int>> vals {16, vector<int>{32}};
vector<bool> useVector{16};
public:
SimEncoders(unsigned int encoderCount, unsigned int s0, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int sigA, unsigned int sigB)
: EncPlex4067(encoderCount, s0, s1, s2, s3, sigA, sigB)
{
for (unsigned i = 0; i < 16; i++)
useVector[i] = false;
}
void setVector(const int index, std::vector<int> v) { useVector[index] = true; vals[index] = v; }
int getValue(const int index) {
if (useVector[index])
return vals[index][encoders[index].getValue()];
return encoders[index].getValue();
}
};
SimEncoders encoders(encoderCount, S0, S1, S2, S3, SIG_A, SIG_B);
void setup() {
encoders.begin();
encoders[0].setLimits(118, 136, true);
encoders[0].setValue(124);
encoders[1].setLimits(0, 15, true);
encoders.setVector(1, std::vector<int>{0, 5, 10, 15, 25, 30, 35, 40, 50, 55, 60, 65, 75, 80, 85, 90});
}
void loop() {
encoders.tick();
for (unsigned i = 0; i < encoderCount; i++) {
if (encoders[i].valueChanged()) {
Serial.print("Encoder:");
Serial.print(i);
Serial.print(" value:");
Serial.println(encoders.getValue(i));
}
}
}
|
Beta Was this translation helpful? Give feedback.
-
Hi,
Been using the code and works great. Got one issue that I want to get your opinion on. I have one encoder set with a limit of 1 - 360. That's a lot of turns. Is there a way to speed it up based on the time delay of the turns?
Thanks,
Joey
…________________________________
From: luni64 ***@***.***>
Sent: Friday, May 26, 2023 10:11 PM
To: luni64/EncoderTool ***@***.***>
Cc: Joey Picinich ***@***.***>; Author ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Thanks, I'll try how this code works here and if I can find anything strange over the weekend. (won't have much time today). What about the buttons? Do you intend to read them out via the EncoderTool as well?
Here your code for easy reference:
/*
Name: Encoder4067MplexTest.ino
Created: 5/22/2023 4:30:15 PM
Author: jpicinich
*/
#include "EncoderTool.h"
#include <vector>
using namespace EncoderTool;
using namespace std;
constexpr unsigned encoderCount = 2; // number of attached encoders
constexpr unsigned S0 = 18;
constexpr unsigned S1 = 19;
constexpr unsigned S2 = 22;
constexpr unsigned S3 = 23;
constexpr unsigned SIG_A = 16;
constexpr unsigned SIG_B = 17;
class SimEncoders : public EncPlex4067 {
vector<vector<int>> vals {16, vector<int>{32}};
vector<bool> useVector{16};
public:
SimEncoders(unsigned int encoderCount, unsigned int s0, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int sigA, unsigned int sigB)
: EncPlex4067(encoderCount, s0, s1, s2, s3, sigA, sigB)
{
for (unsigned i = 0; i < 16; i++)
useVector[i] = false;
}
void setVector(const int index, std::vector<int> v) { useVector[index] = true; vals[index] = v; }
int getValue(const int index) {
if (useVector[index])
return vals[index][encoders[index].getValue()];
return encoders[index].getValue();
}
};
SimEncoders encoders(encoderCount, S0, S1, S2, S3, SIG_A, SIG_B);
void setup() {
encoders.begin();
encoders[0].setLimits(118, 136, true);
encoders[0].setValue(124);
encoders[1].setLimits(0, 15, true);
encoders.setVector(1, std::vector<int>{0, 5, 10, 15, 25, 30, 35, 40, 50, 55, 60, 65, 75, 80, 85, 90});
}
void loop() {
encoders.tick();
for (unsigned i = 0; i < encoderCount; i++) {
if (encoders[i].valueChanged()) {
Serial.print("Encoder:");
Serial.print(i);
Serial.print(" value:");
Serial.println(encoders.getValue(i));
}
}
}
—
Reply to this email directly, view it on GitHub<#34 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVPN2IQJPJWLQNGPW4LXIGEJ7ANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I got a accelerator in the code now. Let me know if you are interested and I can send it to you. I have one issue in that I am using a Type 2 encoder with 20 indents. I only get an update after 2 clicks. I have tried all the options and can't get it to 1 click per update. Any ideas?
Joey
…________________________________
From: JOSEPH PICINICH ***@***.***>
Sent: Saturday, August 5, 2023 3:08 PM
To: luni64/EncoderTool ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Hi,
Been using the code and works great. Got one issue that I want to get your opinion on. I have one encoder set with a limit of 1 - 360. That's a lot of turns. Is there a way to speed it up based on the time delay of the turns?
Thanks,
Joey
________________________________
From: luni64 ***@***.***>
Sent: Friday, May 26, 2023 10:11 PM
To: luni64/EncoderTool ***@***.***>
Cc: Joey Picinich ***@***.***>; Author ***@***.***>
Subject: Re: [luni64/EncoderTool] Problem compiling (Discussion #34)
Thanks, I'll try how this code works here and if I can find anything strange over the weekend. (won't have much time today). What about the buttons? Do you intend to read them out via the EncoderTool as well?
Here your code for easy reference:
/*
Name: Encoder4067MplexTest.ino
Created: 5/22/2023 4:30:15 PM
Author: jpicinich
*/
#include "EncoderTool.h"
#include <vector>
using namespace EncoderTool;
using namespace std;
constexpr unsigned encoderCount = 2; // number of attached encoders
constexpr unsigned S0 = 18;
constexpr unsigned S1 = 19;
constexpr unsigned S2 = 22;
constexpr unsigned S3 = 23;
constexpr unsigned SIG_A = 16;
constexpr unsigned SIG_B = 17;
class SimEncoders : public EncPlex4067 {
vector<vector<int>> vals {16, vector<int>{32}};
vector<bool> useVector{16};
public:
SimEncoders(unsigned int encoderCount, unsigned int s0, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int sigA, unsigned int sigB)
: EncPlex4067(encoderCount, s0, s1, s2, s3, sigA, sigB)
{
for (unsigned i = 0; i < 16; i++)
useVector[i] = false;
}
void setVector(const int index, std::vector<int> v) { useVector[index] = true; vals[index] = v; }
int getValue(const int index) {
if (useVector[index])
return vals[index][encoders[index].getValue()];
return encoders[index].getValue();
}
};
SimEncoders encoders(encoderCount, S0, S1, S2, S3, SIG_A, SIG_B);
void setup() {
encoders.begin();
encoders[0].setLimits(118, 136, true);
encoders[0].setValue(124);
encoders[1].setLimits(0, 15, true);
encoders.setVector(1, std::vector<int>{0, 5, 10, 15, 25, 30, 35, 40, 50, 55, 60, 65, 75, 80, 85, 90});
}
void loop() {
encoders.tick();
for (unsigned i = 0; i < encoderCount; i++) {
if (encoders[i].valueChanged()) {
Serial.print("Encoder:");
Serial.print(i);
Serial.print(" value:");
Serial.println(encoders.getValue(i));
}
}
}
—
Reply to this email directly, view it on GitHub<#34 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AIQNVVPN2IQJPJWLQNGPW4LXIGEJ7ANCNFSM6AAAAAAYK2FHZI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I am using Arduino IDE 2.1 to compile EncoderTool and getting many errors. I am missing something. Below are a list of the errors.
It almost appears to be the wrong C++ version but I thought 2.1.0 was using c++17. If not where do I change?
Beta Was this translation helpful? Give feedback.
All reactions