Make the HFP-enabled firmware robust and usable on real hardware by removing fragile hard-coded assumptions and adding runtime controls.
Avoid unsafe call actions when the Bluetooth stack or peer is not configured, and provide better visibility of runtime state for debugging and operation.
Keep a single codebase that still compiles on non-Classic-BT targets (ESP32-S3) with a clear fallback behavior.
Description
Reworked src/main.cpp to add a runtime peer configuration command (p <mac>) with MAC parsing/validation and persistent runtime string for the peer address, replacing reliance on a single hard-coded MAC constant.
Added HFP stack readiness and connectivity guardrails (g_hfpReady, g_hfpConnected) and checks before performing connect, disconnect, dial, answer, end and volume operations.
Corrected call termination logic so incoming ringing calls are rejected while active/outgoing calls use terminate, and improved state transitions (auto-answer on off-hook during ringing and auto-end on on-hook during active call).
Improved status/help output and runtime observability via printStatus/printHelp, normalized pin/variable names, and maintained clear ESP32-S3 fallback stubs when Classic BT is not available.
Minor docs and project config updates: updated README.md to document p <mac> and serial commands, and adjusted platformio.ini multi-env ordering.
Testing
Installed PlatformIO via python3 -m pip install --user platformio and the install completed successfully.
Built the project for ESP32 Classic environment with ~/.local/bin/platformio run -e esp32dev, and the build completed successfully (SUCCESS).
Built the project for ESP32-S3 environment with ~/.local/bin/platformio run -e esp32-s3-devkitc-1, and the build completed successfully (SUCCESS).
### Motivation
- Make the HFP-enabled firmware robust and usable on real hardware by removing fragile hard-coded assumptions and adding runtime controls.
- Avoid unsafe call actions when the Bluetooth stack or peer is not configured, and provide better visibility of runtime state for debugging and operation.
- Keep a single codebase that still compiles on non-Classic-BT targets (ESP32-S3) with a clear fallback behavior.
### Description
- Reworked `src/main.cpp` to add a runtime peer configuration command (`p <mac>`) with MAC parsing/validation and persistent runtime string for the peer address, replacing reliance on a single hard-coded MAC constant.
- Added HFP stack readiness and connectivity guardrails (`g_hfpReady`, `g_hfpConnected`) and checks before performing `connect`, `disconnect`, `dial`, `answer`, `end` and `volume` operations.
- Corrected call termination logic so incoming ringing calls are `reject`ed while active/outgoing calls use `terminate`, and improved state transitions (auto-answer on off-hook during ringing and auto-end on on-hook during active call).
- Improved status/help output and runtime observability via `printStatus`/`printHelp`, normalized pin/variable names, and maintained clear ESP32-S3 fallback stubs when Classic BT is not available.
- Minor docs and project config updates: updated `README.md` to document `p <mac>` and serial commands, and adjusted `platformio.ini` multi-env ordering.
### Testing
- Installed PlatformIO via `python3 -m pip install --user platformio` and the install completed successfully.
- Built the project for ESP32 Classic environment with `~/.local/bin/platformio run -e esp32dev`, and the build completed successfully (`SUCCESS`).
- Built the project for ESP32-S3 environment with `~/.local/bin/platformio run -e esp32-s3-devkitc-1`, and the build completed successfully (`SUCCESS`).
------
[Codex Task](https://chatgpt.com/codex/tasks/task_e_698f251781c88331968f21592fbf6b90)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Motivation
Description
src/main.cppto add a runtime peer configuration command (p <mac>) with MAC parsing/validation and persistent runtime string for the peer address, replacing reliance on a single hard-coded MAC constant.g_hfpReady,g_hfpConnected) and checks before performingconnect,disconnect,dial,answer,endandvolumeoperations.rejected while active/outgoing calls useterminate, and improved state transitions (auto-answer on off-hook during ringing and auto-end on on-hook during active call).printStatus/printHelp, normalized pin/variable names, and maintained clear ESP32-S3 fallback stubs when Classic BT is not available.README.mdto documentp <mac>and serial commands, and adjustedplatformio.inimulti-env ordering.Testing
python3 -m pip install --user platformioand the install completed successfully.~/.local/bin/platformio run -e esp32dev, and the build completed successfully (SUCCESS).~/.local/bin/platformio run -e esp32-s3-devkitc-1, and the build completed successfully (SUCCESS).Codex Task