Comments (1)
setEncoderValue calls the reset() function, inside AiEsp32RotaryEncoder.cpp
void AiEsp32RotaryEncoder::setEncoderValue(long newValue)
{
reset(newValue);
}
and inside the reset() function there is a "correction" parameter that sets the offset to 1 to our set value (in this case it is 1, but it depends on the set number of steps).
void AiEsp32RotaryEncoder::reset(long newValue_)
{
newValue_ = newValue_ * this->encoderSteps;
this->encoder0Pos = newValue_ + this->correctionOffset;
this->lastReadEncoder0Pos = this->encoder0Pos;
if (this->encoder0Pos > this->_maxEncoderValue)
this->encoder0Pos = this->_circleValues ? this->_minEncoderValue : this->_maxEncoderValue;
if (this->encoder0Pos < this->_minEncoderValue)
this->encoder0Pos = this->_circleValues ? this->_maxEncoderValue : this->_minEncoderValue;
this->lastReadEncoder0Pos = this->readEncoder();
}
If you eliminate that value correction, it would be showing you the real value
- this->encoder0Pos = newValue_ + this->correctionOffset;
+ this->encoder0Pos = newValue_; //+ this->correctionOffset;
correctionOffset is defined within AiEsp32RotaryEncoder.h with value 2.
I don't know very well the reason for this correction, the author will know how to tell us better.
int correctionOffset = 2;
from ai-esp32-rotary-encoder.
Related Issues (20)
- Invalid Pin Selected HOT 5
- Code for Long press-hold HOT 1
- Arduino Nano ESP32 encoder pins HOT 1
- Setting the encoder value outside of the Setup.
- areEncoderPinsPulldownforEsp32=false does not enable PULLUP on esp32 HOT 1
- ESP8266 Compile Error HOT 1
- Arduino IDE 2.2 Standard example Esp32RotaryEncoderBasics.ino fails to compile with the board TTGO T1.
- Arduino IDE 2.2 Standard example Esp32RotaryEncoderBasics.ino fails to compile with the board TTGO T1. HOT 2
- setCount() after setup() HOT 1
- Loss steps HOT 1
- setValue for AiEsp32RotaryEncoderNumberSelector is not working anymore HOT 3
- Compile error HOT 4
- Error when using with WT32-ETH01 Board HOT 10
- Using multiple "encoder number selectors" with one encoder HOT 1
- click extension HOT 4
- rotaryEncoder.setEncoderValue(maxValue); sets to 0 when circleValues set to true
- New release HOT 3
- EEPROM goes max value at esp32 wroom
- The function isEncoderButtonDown() returns an incorrect value when areEncoderPinsPulldown_forEsp32=false HOT 1
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 ai-esp32-rotary-encoder.