Found in whole-codebase review.
NikonBLEClient::doHandshake (esp32/src/common/NikonBLEClient.cpp ~line 154) calls Config::getOrGenerateId(rnd) to rebuild the controller name for the ID characteristic write. The same value was already obtained once in main.cpp setup() to build the BLE device name — it never changes afterwards (generated once, persisted in NVS).
Each call re-opens the NVS namespace and re-reads the key on every (re)connect handshake. Harmless but wasteful.
Proposal: fetch the ID once at startup and pass it down (e.g. store it as a global/static set during setup(), or have NikonBLEClient take the full controller name as a constructor argument).
Found in whole-codebase review.
NikonBLEClient::doHandshake(esp32/src/common/NikonBLEClient.cpp~line 154) callsConfig::getOrGenerateId(rnd)to rebuild the controller name for the ID characteristic write. The same value was already obtained once inmain.cppsetup()to build the BLE device name — it never changes afterwards (generated once, persisted in NVS).Each call re-opens the NVS namespace and re-reads the key on every (re)connect handshake. Harmless but wasteful.
Proposal: fetch the ID once at startup and pass it down (e.g. store it as a global/static set during
setup(), or haveNikonBLEClienttake the full controller name as a constructor argument).