- Naming:
- Methods:
camelCase. - JSON Keys:
camelCase(Variables should use camelCase for native Svelte integration). - Local Variables:
snake_case. - Private Members:
m_prefix (e.g.,m_variable_name). - Constants:
kPascalCase(e.g.,kDefaultPort).
- Methods:
- Documentation: All public/protected members in headers MUST use Doxygen-style comments (
/** ... */,@brief,@param). - Namespaces: Generally use the
og3::namespace. Consider sub-namespaces (e.g.,og3::pkt) only when adding large amounts of related code to maintain organization.
- Module System: Logic must be encapsulated in
Moduleclasses registered with theModuleSystem. Use therequire<T>(name, &ptr)pattern in constructors to manage lifecycle ordering and automate module linking. - Memory Management:
- ESP8266 Sensitivity: Minimize stack usage. Avoid local arrays > 64 bytes; move large structures to the heap during
setup()or use static pools. - Dependency Storage:
ModuleSystemuses transient contiguous storage for requirements during boot; all memory used for linking is reclaimed beforeloop(). - Heap Usage: Prefer not to perform heap allocations in
loop(). Use static pools or pre-allocated buffers for recurring tasks (e.g.,TaskQueuepool).
- ESP8266 Sensitivity: Minimize stack usage. Avoid local arrays > 64 bytes; move large structures to the heap during
- Task Scheduling: Use the
Tasksmodule for any asynchronous or delayed logic; avoid blockingdelay()calls.
- Portability: Always use the
og3::Net*abstraction layer (NetRequest,NetResponse,NetHandler). - Handler Signature: Standard web handlers must use
(NetRequest* request, NetResponse* response). - Status Reporting: Use the
NET_REPLY(request, status)macro to return from web handlers.
- CHANGELOG: Every major update MUST be documented in
CHANGELOG.mdfollowing the Keep a Changelog format. - CI/CD: Maintain automated CI in
.github/workflows/platformio-ci.yaml. All changes must pass native tests and theutil/ci.shbuild script. - Static Analysis: Use
pio check -e nativeto identify performance or portability issues, especially when targeting the ESP8266. - Extensions: New sensor support should follow the
og3x-<sensor>naming convention and remain decoupled from the core library.