Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Много warning при компиляции #9

Closed
demosspro opened this issue Jan 1, 2022 · 14 comments
Closed

Много warning при компиляции #9

demosspro opened this issue Jan 1, 2022 · 14 comments

Comments

@demosspro
Copy link

Подскажите - это нормально - такое количество ворнингов при компиляции?
1.8.16 софт, компилятор (5.4 или 7.3)

image

@GyverLibs
Copy link
Owner

Как получить столько варнингов? У меня ни одного

@demosspro
Copy link
Author

demosspro commented Jan 5, 2022

https://pastebin.com/nhXGximF
Вот код пульта-передатчика.
После пары последних обновлений повылезала куча.
Может для простых кнопок все же вернуться к GyverButton?

@Seriyv0lk
Copy link

Аналогичная история. Варнинги один в один с ТС-ом. Так понимаю, решения нет?

@GyverLibs
Copy link
Owner

Варнинг - не ошибка) если кто то поможет пофиксить непонятные варнинги от шаблона - их не будет

@GyverLibs GyverLibs reopened this Jan 20, 2022
@Seriyv0lk
Copy link

Seriyv0lk commented Jan 20, 2022

Варнинг - не ошибка) если кто то поможет пофиксить непонятные варнинги от шаблона - их не будет

В общем, разобрался. В либе EncButton.h в строке 384 нужно заменить это
if (debounce < (_holdT << 7))
на это
if (debounce < (uint32_t)(_holdT << 7))
Поправь приведение типов, а то платформио варнингами сыпет на весь экран. Ну и предыдущему товарищу решение.
Спасибо.

@Seriyv0lk
Copy link

Ну и спасибо тебе за труд, дружище)

@GyverLibs
Copy link
Owner

Не, этот варнинг ерунда, с ним все понятно. Компилятору лень делать свою работу)

@Seriyv0lk
Copy link

С ним и остальные пропадают.

@GyverLibs
Copy link
Owner

if (debounce < (uint8_t)(_holdT << 7))
Не, так всё сломается, там ведь uint16_t вычисления

@GyverLibs
Copy link
Owner

С ним и остальные пропадают.

Ну и бред) тогда поправлю и релизну сейчас

@Seriyv0lk
Copy link

С ним и остальные пропадают.

Ну и бред) тогда поправлю и релизну сейчас

Опечатался. Там сравнивается с 32-разрядным. Компилер его и хочет.
А у меня было так до правки:

In file included from src\main.cpp:4:0: C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h: In instantiation of 'void EncButton<_EB_MODE, _S1, _S2, _KEY>::poolBtn() [with unsigned char _EB_MODE = 0; unsigned char _S1 = 1; unsigned char _S2 = 255; unsigned char _KEY = 255]': C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:193:24: required from 'uint8_t EncButton<_EB_MODE, _S1, _S2, _KEY>::tickISR(uint8_t, uint8_t, uint8_t) [with unsigned char _EB_MODE = 0; unsigned char _S1 = 1; unsigned char _S2 = 255; unsigned char _KEY = 255; uint8_t = unsigned char]' C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:166:16: required from 'uint8_t EncButton<_EB_MODE, _S1, _S2, _KEY>::tick(uint8_t, uint8_t, uint8_t) [with unsigned char _EB_MODE = 0; unsigned char _S1 = 1; unsigned char _S2 = 255; unsigned char _KEY = 255; uint8_t = unsigned char]' src\main.cpp:35:14: required from here C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:384:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (debounce < ((uint8_t) _holdT << 7)) { // прошло меньше удержания ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h: In instantiation of 'void EncButton<_EB_MODE, _S1, _S2, _KEY>::poolBtn() [with unsigned char _EB_MODE = 0; unsigned char _S1 = 5; unsigned char _S2 = 255; unsigned char _KEY = 255]': C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:193:24: required from 'uint8_t EncButton<_EB_MODE, _S1, _S2, _KEY>::tickISR(uint8_t, uint8_t, uint8_t) [with unsigned char _EB_MODE = 0; unsigned char _S1 = 5; unsigned char _S2 = 255; unsigned char _KEY = 255; uint8_t = unsigned char]' C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:166:16: required from 'uint8_t EncButton<_EB_MODE, _S1, _S2, _KEY>::tick(uint8_t, uint8_t, uint8_t) [with unsigned char _EB_MODE = 0; unsigned char _S1 = 5; unsigned char _S2 = 255; unsigned char _KEY = 255; uint8_t = unsigned char]' src\main.cpp:36:13: required from here C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:384:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h: In instantiation of 'void EncButton<_EB_MODE, _S1, _S2, _KEY>::poolBtn() [with unsigned char _EB_MODE = 0; unsigned char _S1 = 4; unsigned char _S2 = 255; unsigned char _KEY = 255]': C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:193:24: required from 'uint8_t EncButton<_EB_MODE, _S1, _S2, _KEY>::tickISR(uint8_t, uint8_t, uint8_t) [with unsigned char _EB_MODE = 0; unsigned char _S1 = 4; unsigned char _S2 = 255; unsigned char _KEY = 255; uint8_t = unsigned char]' C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:166:16: required from 'uint8_t EncButton<_EB_MODE, _S1, _S2, _KEY>::tick(uint8_t, uint8_t, uint8_t) [with unsigned char _EB_MODE = 0; unsigned char _S1 = 4; unsigned char _S2 = 255; unsigned char _KEY = 255; uint8_t = unsigned char]' src\main.cpp:37:14: required from here C:\Users\Sergey\Documents\Arduino\libraries\EncButton\src/EncButton.h:384:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

@GyverLibs
Copy link
Owner

GyverLibs commented Jan 20, 2022

Самое смешное то в том, что _holdT - изначально unsigned. Непонятно как сдвиг заставляет компилятор решить, что число вдруг стало signed

@Seriyv0lk
Copy link

Меня тоже это сбило с толку сначала. Потом пошёл по цепочке и нашёл несовпадающие типы. Прописал и стало нормально компилиться. Что в ардуине, что в платформио.

@GyverLibs
Copy link
Owner

В общем залил

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants