igorantolic / ai-esp32-rotary-encoder

Easy implement rotary encoder to your application using microcontroler like ESP32
GNU General Public License v2.0
284 stars 70 forks source link

Compilation errors with examples #56

Closed NegativCut closed 1 year ago

NegativCut commented 1 year ago

Hi, I am trying out this library but a few errors persist during compilation. Everything is left untouched in the examples, including pin assignments. I am compiling for ESP32 Dev Module.

`Compiling sketch... In file included from G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:11: G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.h:53:32: warning: left shift of negative value [-Wshift-negative-value] long _minEncoderValue = -1 << 15; ^~

G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp: In member function 'void AiEsp32RotaryEncoder::begin()': G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:199:26: warning: comparison is always true due to limited range of data type [-Wtype-limits] if (this->encoderVccPin >= 0)



G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:207:29: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  if (this->encoderButtonPin >= 0)
      ~~~~~~~~~~~~~~~~~~~~~~~^~~~

G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp: In member function 'ButtonState AiEsp32RotaryEncoder::readButtonState()':
G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:220:14: error: unused variable '_buttonState' [-Werror=unused-variable]
  ButtonState _buttonState = buttonState;
              ^~~~~~~~~~~~

cc1plus.exe: some warnings being treated as errors
Using library Ai_Esp32_Rotary_Encoder at version 1.4 in folder: G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder 
exit status 1
Error compiling for board ESP32 Dev Module.
`

Are these problems with the library, or some upload setting I have?
igorantolic commented 1 year ago

I can see someone changed int to unsigned int vccencoderpin

Until I find some spare time if you know you can modify the code

If you dont need negativne values minencoder can be 0

So with 2 minute change you can fix it And when I find some time I have to recheck all examples

Some people ask for change and I guess I trusted them more than I should

pon, 17. tra 2023. u 05:49 NegativCut @.***> napisao je:

Hi, I am trying out this library but a few errors persist during compilation. Everything is left untouched in the examples, including pin assignments. I am compiling for ESP32 Dev Module.

`Compiling ske In file included from G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:11: G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEnc.h:53:32: warning: left shift of negative value [-Wshift-negative-value] long _minEncoderValue = -1 << 15; ^~

G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp: In member function 'void AiEsp32RotaryEncoder::begin()': G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:199:26: warning: comparison is always true due to limited range of data type [-Wtype-limits] if (this->encoderVccPin >= 0)



G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:207:29:
warning: comparison is always true due to limited range of data type
[-Wtype-limits]
if (this->encoderButtonPin >= 0)
~~~~~~~~~~~~~~~~~~~~~~~^~~~

G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:
In member function 'ButtonState AiEsp32RotaryEncoder::readButtonState()':
G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:220:14:
error: unused variable '_buttonState' [-Werror=unused-variable]
ButtonState _buttonState = buttonState;
^~~~~~~~~~~~

cc1plus.exe: some warnings being treated as errors
Using library Ai_Esp32_Rotary_Encoder at version 1.4 in folder:
G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder
exit status 1
Error compiling for board ESP32 Dev Module.
`

Are these problems with the library, or some upload setting I have?

—
Reply to this email directly, view it on GitHub
<https://github.com/igorantolic/ai-esp32-rotary-encoder/issues/56>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMDZQFXTIVJGUFJU5AKC5TXBS4TNANCNFSM6AAAAAAXATHJ3Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
NegativCut commented 1 year ago

okay, that cleared up some of it, thanks. Still got the following errors reported at compilation;

G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp: In member function 'void AiEsp32RotaryEncoder::begin()': G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:207:29: warning: comparison is always true due to limited range of data type [-Wtype-limits] if (this->encoderButtonPin >= 0)


G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp: In member function 'ButtonState AiEsp32RotaryEncoder::readButtonState()':
G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:220:14: error: unused variable '_buttonState' [-Werror=unused-variable]
  ButtonState _buttonState = buttonState;
              ^~~~~~~~~~~~
igorantolic commented 1 year ago

if (this->encoderButtonPin >= 0)

replace with if (true) or if (false)

remove line ButtonState _buttonState = buttonState;

On Mon, Apr 17, 2023 at 3:08 PM NegativCut @.***> wrote:

okay, that cleared up some of it, thanks. Still got the following errors reported at compilation;

G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp: In member function 'void AiEsp32RotaryEncoder::begin()': G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:207:29: warning: comparison is always true due to limited range of data type [-Wtype-limits] if (this->encoderButtonPin >= 0)


G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:
In member function 'ButtonState AiEsp32RotaryEncoder::readButtonState()':
G:\Dropbox\CODE\libraries\Ai_Esp32_Rotary_Encoder\src\AiEsp32RotaryEncoder.cpp:220:14:
error: unused variable '_buttonState' [-Werror=unused-variable]
ButtonState _buttonState = buttonState;
^~~~~~~~~~~~

—
Reply to this email directly, view it on GitHub
<https://github.com/igorantolic/ai-esp32-rotary-encoder/issues/56#issuecomment-1511309491>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMDZQAVGY2WI6ZKXWB2NTLXBU6EBANCNFSM6AAAAAAXATHJ3Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
igorantolic commented 1 year ago

Corrected - returned to be int again as designed initially. Should work now again