Remove unnecessary comments, clean up code
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
using namespace Adafruit_LittleFS_Namespace;
|
||||
extern File cfgFile;
|
||||
|
||||
// ─── BLE Config Service objects ───────────────────────────────────────────────
|
||||
// BLE Config Service objects
|
||||
#ifndef GIT_HASH
|
||||
#define GIT_HASH "unknown"
|
||||
#endif
|
||||
@@ -26,7 +26,7 @@ BLECharacteristic cfgGitHash (0x1239); // GitHash R 8 bytes (7-char ha
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ─── Charge mode ──────────────────────────────────────────────────────────────
|
||||
// Charge mode
|
||||
void applyChargeMode(ChargeMode mode) {
|
||||
switch (mode) {
|
||||
case CHARGE_OFF: pinMode(PIN_HICHG, INPUT_PULLUP); break;
|
||||
@@ -37,7 +37,7 @@ void applyChargeMode(ChargeMode mode) {
|
||||
Serial.print("[CHG] "); Serial.println(n[mode]);
|
||||
}
|
||||
|
||||
// ─── Config persistence ───────────────────────────────────────────────────────
|
||||
// Config persistence
|
||||
void loadConfig() {
|
||||
InternalFS.begin();
|
||||
cfgFile.open(CONFIG_FILENAME, FILE_O_READ);
|
||||
@@ -57,11 +57,11 @@ void saveConfig() {
|
||||
cfgFile.open(CONFIG_FILENAME, FILE_O_WRITE);
|
||||
if (cfgFile) { cfgFile.write((uint8_t*)&cfg, sizeof(cfg)); cfgFile.close(); }
|
||||
unsigned long elapsed = millis() - t0;
|
||||
if (elapsed > 5) { Serial.print("[CFG] Saved ("); Serial.print(elapsed); Serial.println("ms — flash block)"); }
|
||||
if (elapsed > 5) { Serial.print("[CFG] Saved ("); Serial.print(elapsed); Serial.println("ms - flash block)"); }
|
||||
else { Serial.println("[CFG] Saved"); }
|
||||
}
|
||||
|
||||
// ─── ConfigBlob push ─────────────────────────────────────────────────────────
|
||||
// ConfigBlob push
|
||||
#ifdef FEATURE_CONFIG_SERVICE
|
||||
void pushConfigBlob() {
|
||||
ConfigBlob b;
|
||||
@@ -103,7 +103,7 @@ void factoryReset() {
|
||||
Serial.println("[CFG] Factory reset complete");
|
||||
}
|
||||
|
||||
// ─── BLE callbacks ────────────────────────────────────────────────────────────
|
||||
// BLE callbacks
|
||||
#ifdef FEATURE_CONFIG_SERVICE
|
||||
void onConfigBlobWrite(uint16_t h, BLECharacteristic* c, uint8_t* d, uint16_t l) {
|
||||
if (l != sizeof(ConfigBlob)) { Serial.println("[CFG] Bad blob length"); return; }
|
||||
@@ -134,7 +134,7 @@ void onConfigBlobWrite(uint16_t h, BLECharacteristic* c, uint8_t* d, uint16_t l)
|
||||
setupPhysicalButtons(); // reconfigure pins immediately (no restart needed)
|
||||
#endif
|
||||
saveConfig();
|
||||
Serial.print("[CFG] Written — sens="); Serial.print(cfg.sensitivity,0);
|
||||
Serial.print("[CFG] Written - sens="); Serial.print(cfg.sensitivity,0);
|
||||
Serial.print(" dz="); Serial.print(cfg.deadZone,3);
|
||||
Serial.print(" tapThr="); Serial.print(cfg.tapThreshold);
|
||||
Serial.print(" tapAction="); Serial.println(cfg.tapAction);
|
||||
@@ -153,7 +153,7 @@ void onImuStreamCccd(uint16_t conn_hdl, BLECharacteristic* chr, uint16_t value)
|
||||
}
|
||||
#endif
|
||||
|
||||
// ─── BLE config service setup ─────────────────────────────────────────────────
|
||||
// BLE config service setup
|
||||
void setupConfigService() {
|
||||
cfgService.begin();
|
||||
|
||||
@@ -170,7 +170,7 @@ void setupConfigService() {
|
||||
cfgCommand.setWriteCallback(onCommandWrite);
|
||||
cfgCommand.begin();
|
||||
|
||||
// Git hash — 8-byte fixed field (7 hex chars + NUL), read-only
|
||||
// Git hash - 8-byte fixed field (7 hex chars + NUL), read-only
|
||||
cfgGitHash.setProperties(CHR_PROPS_READ);
|
||||
cfgGitHash.setPermission(SECMODE_OPEN, SECMODE_NO_ACCESS);
|
||||
cfgGitHash.setFixedLen(8);
|
||||
@@ -206,7 +206,7 @@ void setupConfigService() {
|
||||
}
|
||||
#endif // FEATURE_CONFIG_SERVICE
|
||||
|
||||
// ─── Telemetry push ───────────────────────────────────────────────────────────
|
||||
// Telemetry push
|
||||
#ifdef FEATURE_TELEMETRY
|
||||
void pushTelemetry(unsigned long now) {
|
||||
telem.uptimeSeconds = now / 1000;
|
||||
|
||||
Reference in New Issue
Block a user