Skip to content

Refactor/ctrler mod - #27

Open
Kerlynx wants to merge 6 commits into
NCPlyn:ProtoESPfrom
Kerlynx:refactor/ctrler-mod
Open

Refactor/ctrler mod#27
Kerlynx wants to merge 6 commits into
NCPlyn:ProtoESPfrom
Kerlynx:refactor/ctrler-mod

Conversation

@Kerlynx

@Kerlynx Kerlynx commented Aug 7, 2026

Copy link
Copy Markdown

I think modualize is a good idea for further optimization so that's why I had started this PR

Kerlynx added 6 commits July 23, 2026 10:41
 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
@NCPlyn

NCPlyn commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Hi, really don't want to refactor the entire code, as I'm happy with it now to some point and it works ¯_(ツ)_/¯.
Now it is slightly abadonware from my side as I don't have much free time, only trying to fix what's notified to me as broken or similiar.
Also the todo.md is nearly empty... I would gladly more welcome, for example from the todo.md, a guide for newcomers using the Animator or new interactive RGB animations/prefabs/options when shaking head/booping to utilize the RGB matrices more...
You can make (already have) / maintain seperate fork of thing repo with the refractors etc if you would like to.

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

Successfully merging this pull request may close these issues.

2 participants