Breakage caused by PinStatus and PinMode types
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- cpp
- 領域
- api, embedded-iot
調査の方向性
api/Common.h から始め、Keypad の例と digitalWrite(13, !digitalRead(13)) のケースを使って、報告されたコンパイル失敗を再現してください。互換性に関する決定を理解するため、リンクされた議論と関連する issue を確認してください。この issue は、プロジェクトが決定に到達してそれを文書化し、影響を受ける互換性の動作が検証された場合にのみ完了します。
索引モデルが issue の本文から書いたものです。
説明
This project changes LOW, HIGH, INPUT, INPUT_PULLUP, and OUTPUT from macros to enums:
https://github.com/arduino/ArduinoCore-API/blob/e1eb8de126786b7701b211332dda3f09aa400f35/api/Common.h#L10-L23
I'm concerned that this will cause breakage of a significant amount of existing code.
An example is the popular Keypad library. Compilation of both the original library and the version in Library Manager fails once this change is made.
In file included from E:\electronics\arduino\libraries\Keypad-master\examples\HelloKeypad\HelloKeypad.ino:10:0:
E:\electronics\arduino\libraries\Keypad-master\src/Keypad.h: In member function 'virtual void Keypad::pin_write(byte, boolean)':
E:\electronics\arduino\libraries\Keypad-master\src/Keypad.h:81:81: error: cannot convert 'boolean {aka bool}' to 'PinStatus' for argument '2' to 'void digitalWrite(pin_size_t, PinStatus)'
virtual void pin_write(byte pinNum, boolean level) { digitalWrite(pinNum, level); }
This commonly used code will also now fail:
digitalWrite(13, !digitalRead(13)); // toggle pin 13
toggle:2:36: error: cannot convert 'bool' to 'PinStatus' for argument '2' to 'void digitalWrite(pin_size_t, PinStatus)'
digitalWrite(13, !digitalRead(13)); // toggle pin 13
I understand that the root cause of these errors is bad code and that any code which followed best practices will have no problems with this change. However, I fear there is a lot of bad code in widespread use that currently works fine. In the case of the Keypad library, it is unlikely it can even be fixed since Chris--A has gone AWOL. I'm sure there are other such abandoned projects.
I do like the spirit of this change (though lumping CHANGE, FALLING, and RISING into PinStatus is questionable). I'm open to being convinced that it's worth the breakage and, if so, I'm willing to help ease the transition by providing user support and submitting PRs to fix broken code. I just think this warrants some consideration before ArduinoCore-API goes into more widespread use.
Additional context
Some previous discussion on the topic:
- http://forum.arduino.cc/index.php?topic=455579 (from here onward)
- https://forum.arduino.cc/index.php?topic=584322
- http://forum.arduino.cc/index.php?topic=602250
- https://forum.arduino.cc/index.php?topic=621429
- https://forum.arduino.cc/index.php?topic=627883.msg4319254#msg4319254
- https://forum.arduino.cc/index.php?topic=659624
- https://github.com/arduino/ArduinoCore-megaavr/issues/68
Related
- 主要言語
- C++
- スター
- 307
- フォーク
- 152
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
arduino/ArduinoCore-API のほかの issue
-
Bit manipulation not working with 64 bit values対応中かも @asumo-1xts が 36 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
arduino/ArduinoCore-API#261 ·
-
Missing virtual destructor for `Print` class対応中かも @andreagilardoni が 1104 日前に担当しました。 オープンbug
難易度 1/5 1時間未満 初心者へのやさしさ 30/100
arduino/ArduinoCore-API#256 ·
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
arduino/ArduinoCore-API#251 · コメント 1 件 ·
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
arduino/ArduinoCore-API#250 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
arduino/ArduinoCore-API#249 ·
arduino/ArduinoCore-API の issue をすべて見る
似ている issue
-
Make Catch2 optional when `RDK_BUILD_CPP_TESTS=OFF`対応中かも @pechersky が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
dice-group/dice-hash#111 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
google/libaddressinput#255 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
MerginMaps/mobile#4741 ·
メンテナーはふだん 1 日以内に返信