Skip to content

Ping Guard and Voltage Sensor#188

Merged
k3ldar merged 3 commits into
mainfrom
feature/VoltSensorAndSecurePins
May 7, 2026
Merged

Ping Guard and Voltage Sensor#188
k3ldar merged 3 commits into
mainfrom
feature/VoltSensorAndSecurePins

Conversation

@k3ldar
Copy link
Copy Markdown
Owner

@k3ldar k3ldar commented May 7, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 7, 2026 16:43
@k3ldar k3ldar linked an issue May 7, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces PinGuard (GPIO assignment validation) plus a crash-loop guard to recover from watchdog reboot loops caused by bad persisted pin configuration, and adds a new Voltage Sensor type + command/docs updates (including GPS config changes on ESP32).

Changes:

  • Add PinGuard validation + system command F14 to configure PinGuard runtime mode, and integrate pin validation into multiple pin-setting paths (SPI/SD, relays, Nextion, etc.).
  • Add crash-loop detection using a persisted crash counter that triggers config reset to safe defaults after a threshold.
  • Add a new VoltageSensor implementation (S23) and extend sensor/docs/test data for new/updated command formats.

Reviewed changes

Copilot reviewed 30 out of 32 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
TestData/test-commands.txt Updates external sensor remove command format to use v=<idx>.
README.md Documents PinGuard and crash-loop guard; links new PinGuard docs.
PowerControlHub/WarningType.h Adds GpsInvalidConfig and LowVoltage warnings + display strings.
PowerControlHub/VoltageSensorHandler.h Adds a new Voltage sensor handler that publishes S23 and raises LowVoltage.
PowerControlHub/SystemDefinitions.h Adds F14 system command ID and S23 sensor command ID + new sensor enum value.
PowerControlHub/SystemCommandHandler.cpp Implements F14 to persist/apply PinGuard mode flags.
PowerControlHub/SensorFactory.h Adds Voltage sensor creation; updates GPS creation on ESP32 to use configured UART/pins.
PowerControlHub/SensorConfigCommandHandler.h Changes sensor config broadcast fields; updates remove command to S2:v=<idx> and adjusts semantics.
PowerControlHub/RelayController.h Adds RelayResult::InvalidPin and validates relay pin assignments with PinGuard.
PowerControlHub/RelayCommandHandler.cpp Returns Invalid pin for blocked relay pin assignments and emits debug reason.
PowerControlHub/PowerControlHubApp.cpp Adds crash counter increment/reset flow and applies persisted PinGuard mode early in boot.
PowerControlHub/PowerControlHub.vcxproj.filters Adds new headers to VS filters; removes some legacy entries.
PowerControlHub/PowerControlHub.ino Removes manual GPS serial init and updates comments to reflect config-driven init.
PowerControlHub/PinGuard.h Adds PinGuard implementation (pin tables, modes, validation, reason strings).
PowerControlHub/NextionConfigCommandHandler.h Adds InvalidPin handling and debug output for Nextion pin setters.
PowerControlHub/MicroSdDriver.cpp Adds PinGuard hard-block checks before SPI init to avoid crashes/hangs.
PowerControlHub/Local.h Adds PinGuard-related explanatory comments.
PowerControlHub/ExternalSensorNetworkHandler.cpp Updates external sensor remove semantics to v=<idx> and treats “already absent” as success.
PowerControlHub/ExternalSensorConfigCommandHandler.h Updates external sensor remove semantics to v=<idx> and treats “already absent” as success.
PowerControlHub/ConfigNetworkHandler.cpp Updates REST external sensor remove semantics to v=<idx> and treats “already absent” as success.
PowerControlHub/ConfigManager.h Adds crash counter increment API and persisted PinGuard flags setter.
PowerControlHub/ConfigManager.cpp Implements crash counter increment and persisted PinGuard flags setter.
PowerControlHub/ConfigController.h Adds ConfigResult::InvalidPin.
PowerControlHub/ConfigController.cpp Adds PinGuard validation to several pin setters (SPI/SD/RTC/RGB/Nextion/XpdzTone).
PowerControlHub/ConfigCommandHandler.cpp Adds debug output and ACK ... Invalid pin mapping for ConfigResult::InvalidPin.
PowerControlHub/Config.h Repurposes header byte at offset 13 as pinGuardFlags.
PowerControlHub/BoardConfig.h Includes PinGuard from the framework board config layer.
PowerControlHub.sln Updates some solution item paths (Docs/TestData).
Docs/PinGuard.md Adds documentation for PinGuard tiers, board tables, crash-loop guard, and F14.
Docs/Commands.md Documents F14, adds Voltage sensor type + setup, updates several sensor config semantics, adds S23.
.gitignore Adds /LocalOnly ignore entry.
Comments suppressed due to low confidence (1)

PowerControlHub.sln:19

  • The solution items use a mix of ..\Docs\... and Docs\... paths (e.g. Commands.md vs the rest). Unless the solution is intentionally meant to be opened from a different directory, this inconsistency will cause some docs to be missing in Visual Studio. Consider making the docs paths consistent (all relative to the .sln location).
	ProjectSection(SolutionItems) = preProject
		..\Docs\BluetoothBle.md = ..\Docs\BluetoothBle.md
		Docs\Commands.md = Docs\Commands.md
		..\Docs\DateTime.md = ..\Docs\DateTime.md
		..\Docs\LedManager.md = ..\Docs\LedManager.md
		..\LICENSE = ..\LICENSE
		..\Docs\Local.md = ..\Docs\Local.md
		..\Docs\MessageBus.md = ..\Docs\MessageBus.md
		Docs\pcbway.md = Docs\pcbway.md
		..\Docs\RestApi.md = ..\Docs\RestApi.md
		..\Docs\ScheduleEvents.md = ..\Docs\ScheduleEvents.md
		..\Docs\Sensors.md = ..\Docs\Sensors.md
		..\Docs\Warnings.md = ..\Docs\Warnings.md

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread PowerControlHub/PinGuard.h
Comment thread PowerControlHub/PinGuard.h
Comment thread PowerControlHub/BoardConfig.h Outdated
Comment thread PowerControlHub/VoltageSensorHandler.h
Comment thread PowerControlHub/VoltageSensorHandler.h
Comment thread PowerControlHub/PowerControlHubApp.cpp
Comment thread Docs/Commands.md Outdated
Comment thread Docs/Commands.md
Comment thread README.md
Comment thread Docs/PinGuard.md
k3ldar and others added 2 commits May 7, 2026 19:07
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@k3ldar k3ldar merged commit 8fad94c into main May 7, 2026
1 check passed
@k3ldar k3ldar deleted the feature/VoltSensorAndSecurePins branch May 7, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate ESP32 Pins

2 participants