Skip to content

Commit 45d4849

Browse files
committed
Prepare v1.0 release: versioning, relay config, clear button
Adds FIRMWARE_VERSION tracking to all components and displays version in Serial output. Implements per-relay configurable momentary durations, physical clear button support on client, and manual relay clear controls in server dashboard. Updates config generator and UI to support new relay and input features. Adds DEBUG_MODE guards for conditional debug output. Ready for initial deployment with improved version tracking, debug controls, and relay management.
1 parent 39fb090 commit 45d4849

File tree

4 files changed

+647
-19
lines changed

4 files changed

+647
-19
lines changed

CODE REVIEW/CODE_REVIEW_112025.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,108 @@ return linearMap(avg, 0.05f, 0.95f, 0.0f, cfg.heightInches);
349349
350350
---
351351
352+
## V1.0 Release Updates (December 6, 2025)
353+
354+
### Changes Applied for V1.0 Release
355+
356+
The following updates were implemented as part of the v1.0 release preparation:
357+
358+
#### 1. Version Tracking Added
359+
- **All Components**: Added `FIRMWARE_VERSION "1.0.0"` constant to Client, Server, and Viewer
360+
- Firmware version now displayed in startup Serial messages
361+
- Enables proper version tracking for future updates and debugging
362+
363+
#### 2. DEBUG_MODE Guards Implemented
364+
- **Server & Viewer**: Added `#define DEBUG_MODE 1` with conditional debug output
365+
- `notecard.setDebugOutputStream()` now only enabled when `DEBUG_MODE` is set
366+
- Reduces noise in production deployments while allowing debug builds
367+
368+
#### 3. Per-Relay Configurable Momentary Durations
369+
- **Client**: Added `relayMomentarySeconds[4]` array to `TankConfig` struct
370+
- Each relay (R1-R4) can have independent timeout duration
371+
- Valid range: 1 second to 86,400 seconds (24 hours)
372+
- Value of 0 uses default (30 minutes / 1800 seconds)
373+
- Durations are persisted in config JSON as `relayMomentaryDurations` array
374+
375+
- **Server Config UI**: Added duration input fields in relay section
376+
- Per-relay duration inputs visible when "Momentary" mode selected
377+
- Values included in generated config JSON
378+
- UI hides durations when other relay modes selected
379+
380+
#### 4. Relay Mode Dropdown Updated
381+
- Changed label from "Momentary (30 min on, then auto-off)" to "Momentary (configurable duration)"
382+
- Reflects new per-relay duration capability
383+
384+
#### 5. Manual Override Capabilities
385+
- **Server Dashboard**: Added "Relay Control" column with "Clear" button per tank row
386+
- Clicking "Clear" sends command via Device-to-Device API to reset all relay alarms on that tank's client
387+
- New `/api/relay/clear` endpoint handles POST requests with tank index
388+
- JavaScript functions: `relayButtons()` renders buttons, `clearRelays(tankIndex)` triggers API call
389+
390+
#### 6. Physical Clear Button on Client
391+
- **Client Hardware**: Added support for optional physical button to clear all relay alarms
392+
- New config fields in `ClientConfig`:
393+
- `clearButtonPin` (int8_t): GPIO pin number, -1 to disable
394+
- `clearButtonActiveHigh` (bool): Set based on button wiring (to VCC or GND)
395+
- Functions added:
396+
- `initializeClearButton()`: Configures pin with appropriate pull-up/pull-down
397+
- `checkClearButton()`: Debounced button check (500ms press required)
398+
- `clearAllRelayAlarms()`: Resets all relay outputs and clears alarm states
399+
- **Client Console UI**: Added configuration fields for button pin and active state
400+
401+
#### 7. Extensible Input Configuration
402+
- **Config Generator**: Added "Inputs (Buttons & Switches)" section in Config Generator webpage
403+
- Inputs are configured like sensors with:
404+
- Input Name
405+
- Pin Number
406+
- Input Mode (Active LOW / Active HIGH)
407+
- Action (Clear All Relay Alarms / Disabled)
408+
- Designed for extensibility - future input actions can be added (e.g., trigger test mode, force report, etc.)
409+
- Config download maps inputs to appropriate config fields (clearButtonPin, clearButtonActiveHigh)
410+
411+
### Remaining TODO Items
412+
413+
The following items from the original review are still pending for future releases:
414+
415+
| Priority | Item | Notes |
416+
|----------|------|-------|
417+
| High | Independent relay timeout tracking | Current implementation uses minimum duration across all relays in mask. Future: track each relay independently with `gRelayActivationTime[tank][relay]` |
418+
| Medium | Relay status synchronization | When client restarts, relay state isn't synced with physical relay hardware |
419+
| Medium | Server-side duration UI validation | Add min/max validation and friendly time format (mm:ss or HH:mm:ss) |
420+
| Low | Presets for common durations | Add dropdown presets: 1 min, 5 min, 15 min, 30 min, 1 hour, etc. |
421+
422+
### Future Improvement Suggestions
423+
424+
#### Relay Control Enhancements
425+
1. **Per-Relay Independent Tracking**: Refactor to track activation time per relay, not per tank. This would allow R1 and R3 to have different remaining times.
426+
```cpp
427+
// Current (per-tank):
428+
unsigned long gRelayActivationTime[MAX_TANKS];
429+
430+
// Future (per-relay):
431+
unsigned long gRelayActivationTime[MAX_TANKS][4];
432+
bool gRelayActive[MAX_TANKS][4];
433+
```
434+
435+
2. **Remaining Time Display**: Show countdown timer on Server dashboard for active momentary relays
436+
437+
3. **Manual Override**: Add web UI button to manually extend or reset relay timers
438+
439+
4. **Staggered Deactivation**: When multiple relays have different durations, deactivate each at its configured time rather than all at once
440+
441+
#### Configuration UI Enhancements
442+
1. **Human-Readable Duration Input**: Convert seconds to hours:minutes:seconds format
443+
2. **Quick Duration Presets**: Buttons for common values (1min, 5min, 30min, 1hr)
444+
3. **Validation Feedback**: Real-time validation with error messages for invalid values
445+
4. **Import/Export Relay Settings**: Allow copying relay configuration between tanks
446+
447+
#### Production Hardening
448+
1. **Relay State Persistence**: Save active relay state to flash, restore on boot
449+
2. **Relay Health Check**: Verify relay actually toggled using feedback circuit
450+
3. **Failsafe Mode**: Auto-deactivate all relays after configurable maximum runtime (e.g., 24 hours)
451+
452+
---
453+
352454
## Overall Assessment
353455

354456
**Strengths:**
@@ -366,3 +468,5 @@ return linearMap(avg, 0.05f, 0.95f, 0.0f, cfg.heightInches);
366468
- Missing production-ready features (watchdog, graceful degradation)
367469

368470
**Verdict:** The code is a solid foundation but needs significant hardening before production deployment. Focus on critical bugs and security issues first, then address reliability and performance concerns.
471+
472+
**V1.0 Status:** Ready for initial deployment with version tracking, debug controls, and configurable relay durations. Core functionality is stable.

0 commit comments

Comments
 (0)