This shows you the differences between two versions of the page.
pm:prj2022:apredescu:111 [2022/05/20 17:58] dinu_stefan.rusu [Introduction] |
pm:prj2022:apredescu:111 [2022/06/24 10:38] (current) dinu_stefan.rusu [Download] |
||
---|---|---|---|
Line 21: | Line 21: | ||
Modularity and reusability were key while writing the code for the wallet, in order to allow for ease of expansion, and addition of new features. | Modularity and reusability were key while writing the code for the wallet, in order to allow for ease of expansion, and addition of new features. | ||
+ | |||
+ | In order to easily debug the code and to trim'spammy' logs in the case that not all of them are necessary, 3 logging levels exist (No logs, warning, warning & info), and 2 type of logs (Info & Warning). Logging is handled by: | ||
+ | <code>void printDebugInfoMessage(const String &message)</code> | ||
+ | and | ||
+ | <code>void printDebugWarningMessage(const String &message)</code> | ||
+ | |||
+ | In order to define the logging level, debuggingLevelEnabled from currentState must be changed to one of: NO_LOGS, WARNINGS, INFO. | ||
To decode the signal from the remote, the <code>String decodeRemoteCode(uint32_t code)</code> function is used, that contains a switch that returns the letter that was pressed. I did not use a HashMap in order to save memory. | To decode the signal from the remote, the <code>String decodeRemoteCode(uint32_t code)</code> function is used, that contains a switch that returns the letter that was pressed. I did not use a HashMap in order to save memory. | ||
Line 26: | Line 33: | ||
Each remote code is written as a define at the top of the program, in order to easily update the code in case that a different remote is used. Also, all other constants such as pins, the password cover, and the logging levels are defined in the same way. | Each remote code is written as a define at the top of the program, in order to easily update the code in case that a different remote is used. Also, all other constants such as pins, the password cover, and the logging levels are defined in the same way. | ||
- | The wallet has a custom built state management system, in order to not refresh the display every time loop() is ran. The state of the wallet is kept in a struct, and if any field in that struct is changed, a state changed is triggered, and the display is refreshed. | + | The wallet has a custom built state management system, in order to not refresh the display every time loop() is ran. The state of the wallet is kept in a struct, and if any field in that struct is changed, a state changed is triggered, and the display is refreshed. The state is handled by: |
+ | <code>void setState(int32_t state, int32_t debuggingEnabled, const String &display, const String &displayRow2, const String &input = currentState.input, const String &password = currentState.password, const String &secrets = currentState.secrets)</code> | ||
- | In order to write to the display, a custom function is used, that handles a few write modes, such as appending text and overwriting, and also the line on which the text is going to be written to. | + | In order to write to the display, a custom function is used, that handles a few write modes, such as appending text and overwriting, and also the line on which the text is going to be written to. Writing to the display is handled by: |
+ | <code>void writeToDisplay(const String &word, bool append = true, bool firstRow = true, bool appendSpace = true)</code> | ||
- | There are 3 logging levels: NO LOGS, WARNINGS and INFO, in order to easily debug the code, and trimming 'spammy' logs in the case that not all of them are necessary. | + | The companion app is a cross-platform app, written in Flutter (a framework for building cross-platform apps developed by Google, on top of Dart) that allows the user to get the wallet password and view quick tutorials about each mode of the wallet. |
- | + | ||
- | The companion app is a cross-platform app, written in Flutter that allows the user to get the wallet password and view quick tutorials about each mode of the wallet. | + | |
Line 56: | Line 63: | ||
This was the first project of this type that I've made, it helped me better understand the labs, and how hardware works. | This was the first project of this type that I've made, it helped me better understand the labs, and how hardware works. | ||
===== Download ===== | ===== Download ===== | ||
- | You can find the code for the Arduino [[https://github.com/xrusu/ma-lab|here]] https://github.com/xrusu/ma-lab and for the companion app [[https://github.com/xrusu/ma-lab-companion|here]] https://github.com/xrusu/ma-lab-companion, or you can download the archives from here: | + | You can find the code for the Arduino [[https://github.com/xrusu/arduino-password-manager|here]] https://github.com/xrusu/arduino-password-manager and for the companion app [[https://github.com/xrusu/arduino-password-manager-companion|here]] https://github.com/xrusu/arduino-password-manager-companion, or you can download the archives from here: |
{{:pm:prj2022:ea:dinu_stefan_rusu:rusu_dinu_stefan_1221a_arduino_code.zip|Wallet code archive}} | {{:pm:prj2022:ea:dinu_stefan_rusu:rusu_dinu_stefan_1221a_arduino_code.zip|Wallet code archive}} | ||
Line 65: | Line 72: | ||
===== Log ===== | ===== Log ===== | ||
- | 21/04/2022: Project selection | + | 20/05/2022: Added more details about 'Software' on wiki |
- | 22/04/2022: Wiki page | + | 09/05/2022: Wiki brush-up |
- | + | ||
- | 07/05/2022: Started writing the software | + | |
08/05/2022: Code brush-up | 08/05/2022: Code brush-up | ||
- | 09/05/2022: Wiki brush-up | + | 07/05/2022: Started writing the software |
+ | 22/04/2022: Wiki page | ||
+ | |||
+ | 21/04/2022: Project selection | ||
===== Bibliography/Resources ===== | ===== Bibliography/Resources ===== | ||
Line 80: | Line 88: | ||
[[https://www.vishay.com/docs/82491/tsop382.pdf | IR Receiver Datasheet]] | [[https://www.vishay.com/docs/82491/tsop382.pdf | IR Receiver Datasheet]] | ||
+ | |||
+ | [[https://dart.dev/ | Dart]] | ||
+ | |||
+ | [[https://docs.flutter.dev/ | Flutter]] | ||
<html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||