Refactor/ctrler mod - #27
Open
Kerlynx wants to merge 6 commits into
Open
Conversation
1. for oled, reasonably refactor bright control and initiallizer - for bright control, using switch-cases to replace if-else chain - for initiallizer, using a better checking/returning logic 2. for misc, inline some functions and use more bitewise operation to reduce the memory cost - inline the function isApproxEqual and mapfloat as they are so small. - refactor the speakMatrix based on the original logic, using bitwise operations on logic, simplify converting process, reduce the memory cost form 8 * 8 * sizeof(int) to 8 * 8bit (sizeof(uint8_t)) 3. for fileOp, inline all methods in CrcWriter
- Move all user-configurable macros (#define) and toggle variables (earPresent, blushPresent, etc.) from main.cpp to config.h. - Use C++17 inline variables for toggles to allow single definition in header while keeping runtime mutability. - Use C++17 if-init-statement in oled.cpp for more concise error check. - Update platformio.ini to explicitly enable -std=gnu++17 (already used). - No functional changes; user now only needs to edit config.h to adapt hardware, without touching main.cpp. - Update README.md and touchSensors.md to reflect config.h file location and new setup instructions.
- Create logger.h and logger.cpp to hold logBuffer, logIndex, and logPrint overloads - Use extern declarations to maintain original global variable scope - Mark lightweight logPrint overloads as inline for zero overhead - Update main.cpp to include logger.h and remove inline definitions
- modularize BLE - modularize Wifi - put devices into one single header - simplify main.cpp
Owner
|
Hi, really don't want to refactor the entire code, as I'm happy with it now to some point and it works ¯_(ツ)_/¯. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I think modualize is a good idea for further optimization so that's why I had started this PR