Skip to content

RFID Access Control v1.0.1

Latest

Choose a tag to compare

@Hyacinthe-primus Hyacinthe-primus released this 17 Jul 19:32
· 3 commits to main since this release

RFID Access Control v1.0.1

Bug-fix and performance release. No breaking changes to the on-disk data your users already have, existing users.json databases migrate automatically on first boot. The serial baud rate changed (921600 → 2000000): update the Python CLI alongside the firmware, or commands will get garbled output.

Highlights

  • User database format switched from JSON to a fixed-width binary format (users.bin) -- imports, exports, and saves are dramatically faster, with per-record and whole-database CRC32 integrity checks.
  • New sync command: makes the device match a local file exactly via a remove/add/replace diff, instead of import's additive-or-destructive model.
  • User limit raised 10,000 → 70,000 entries.
  • Five real crash/reboot bugs fixed, including two device reboots that only showed up at high user counts.

Bug Fixes

  • save() no-file crash window: a power loss mid-save could leave the device with no database file at all. Finalization is now a single atomic rename with pre-write CRC verification, instead of remove-then-rename.
  • save() stack overflow: the flush buffer moved from an 8KB stack array (which alone nearly exhausted the 8KB loop task stack) to a PSRAM heap allocation.
  • TWDT reboot every ~10.25s: loop() never fed the Task Watchdog Timer once subscribed. Fixed with esp_task_wdt_reset() at the top of loop().
  • list reboots the device above ~15,000 users: streaming the full list in one loop() iteration could outrun the watchdog timeout. Fixed by resetting the watchdog every 256 users during the stream.
  • removeUser() build error on some cores: fs::File::truncate() doesn't exist on this toolchain. Removal now falls back to a full rewrite instead of failing to compile.
  • import/export .bin handling: .bin files were silently misparsed as CSV on import, and .bin exports were missing their 7-byte header and failed to re-import. Both fixed and verified round-trip clean.

New Features

  • sync command – device-side manifest diff (uid + per-record CRC32), one binary transfer for the whole delta, final db_crc32 comparison to confirm the databases actually match.
  • Binary user database (users.bin) replacing NDJSON, with automatic migration from existing users.json (kept as .bak).
  • Sorted array + targeted savesusers_ stays physically sorted by UID; rename/renew get a true single-record write, addUser() rewrites only the suffix from the insertion point.
  • Raw binary import/export sub-protocol (import_bin/export_bin) – no JSON framing or parsing for bulk transfers. CLI uses this by default; --json-transport falls back to the old pipeline.
  • CRC32 fingerprint skip – re-importing a file the device already has now skips the transfer and save entirely.
  • find --uid (O(log n) binary search, device-side) and find --name (device-side substring match); only matching records cross serial.
  • Backup format promptremove --force and import --clear now ask for JSON or .bin before wiping; --no-backup skips it.
  • File encoding fallback for import (utf-8-sig → cp1252 → latin-1), fixing failures on Excel-exported CSVs from Windows/French locales.

Changed

  • User limit: 10,000 → 70,000 entries (PSRAM-backed allocator).
  • Serial baud rate: 921,600 → 2,000,000. Update the CLI alongside the firmware.
  • Line buffer: 4096 → 16384 bytes, supporting ~100 users per batch_add line.
  • Batch import size: 15 → 100 users per round-trip.
  • CLI boot-wait timeout: 15s → 45s, covering first-boot LittleFS.format() on the 12MB partition.
  • partitions.csv: coredump partition added (64KB).

Python CLI

Now 17 subcommands (added sync). All existing v1.0.0 commands are unchanged in behavior; import/export default to the faster binary transport automatically.

Requirements

Same as v1.0.0 – Arduino IDE 2.x, ESP32 board package v3.x, Adafruit PN532, LiquidCrystal I2C, ArduinoJson v7.x, Python 3.9+. prompt-toolkit and rich remain required for the interactive shell.

Full diff: see CHANGELOG for complete technical detail on every fix and feature above.

Full Changelog: v1.0.0...v1.0.1