Skip to content

Add Windows Configuration Tool and Serial Configuration Protocol #123

@lufthan45

Description

@lufthan45

Overview

Add a comprehensive serial configuration system to the OMOTE firmware along with a Windows desktop application for easy device configuration.

Firmware Modifications Required

1. Serial Configuration Protocol (JSON-based)

  • Implement a JSON-based serial communication protocol for configuration
  • Support bidirectional communication (read/write configurations)
  • Ensure non-blocking serial communication to prevent firmware freezing
  • Protocol should handle:
    • Configuration requests (GET)
    • Configuration updates (SET)
    • Status queries
    • Acknowledgments and error responses

2. Command Handlers

Create command handlers for all settings including:

  • WiFi configuration (SSID, Password)
  • MQTT settings (Broker, Port, Username, Password)
  • IR codes (TV, Amplifier, Media Players)
  • BLE Keyboard settings
  • Display settings (Brightness, Sleep timeout)
  • Hardware settings (Motion detection, Keyboard backlight)
  • Scene configuration

3. NVS Storage Integration

  • Integrate with existing NVS (Non-Volatile Storage) system
  • Persist all configuration changes to NVS
  • Support reading current configuration from NVS
  • Handle configuration validation before storage

4. Non-blocking Serial Communication

  • Implement asynchronous serial processing
  • Use appropriate buffers for incoming/outgoing data
  • Prevent blocking the main firmware loop
  • Handle partial messages and buffer overflow scenarios

Windows Desktop Application

Application Type

  • C# WPF application with modern UI design
  • Target .NET Framework 4.7.2+ or .NET 6/7

UI Features

Main Interface

  • Tabbed interface for organized configuration sections
  • Clean, modern design following Windows UI guidelines
  • Real-time device status display
  • Connection indicator

Serial Communication Tab

  • Auto-detect available COM ports
  • Connect/Disconnect functionality
  • Connection status indicator
  • Baud rate selection (default: 115200)

Configuration Tabs

WiFi Configuration:

  • SSID input field
  • Password input field (masked)
  • Test connection button
  • Status indicator

MQTT Configuration:

  • Broker address input
  • Port number input
  • Username input
  • Password input (masked)
  • Test connection button
  • Connection status

IR Codes Configuration:

  • Device type selector (TV, Amplifier, Media Player)
  • IR code database browser
  • Custom IR code input
  • Test IR code functionality
  • Import/Export IR codes

BLE Keyboard Settings:

  • Enable/Disable BLE keyboard
  • Device name configuration
  • Pairing settings

Display Settings:

  • Brightness slider (0-100%)
  • Sleep timeout configuration
  • Screen saver settings

Hardware Settings:

  • Motion detection enable/disable
  • Motion sensitivity slider
  • Keyboard backlight enable/disable
  • Backlight brightness
  • Backlight timeout

Scene Configuration:

  • Scene list viewer
  • Add/Edit/Delete scenes
  • Scene action configuration
  • Scene testing

Core Features

Configuration Management:

  • Read current config from device button
  • Write new config to device button
  • Apply individual section changes
  • Revert changes functionality

Import/Export:

  • Export configuration to JSON file
  • Import configuration from JSON file
  • Drag-and-drop JSON file support
  • Configuration file validation

IR Code Database:

  • Pre-loaded database of common IR codes
  • Brand/model selection
  • Search functionality
  • User can add custom codes

Validation:

  • Real-time input validation
  • Visual feedback for invalid inputs
  • Prevent invalid configurations from being sent
  • Validation error messages

Testing:

  • WiFi connectivity test
  • MQTT connection test
  • IR code test buttons
  • Real-time feedback on test results

Documentation Required

1. User Guide for Windows App

Create a comprehensive user guide including:

  • Installation instructions
  • First-time setup guide
  • Connecting to OMOTE device
  • Configuring each section
  • Troubleshooting common issues
  • Screenshots of the application
  • FAQ section

2. Protocol Documentation

Document the serial communication protocol:

  • Message format specification
  • Command reference (all GET/SET commands)
  • Response format
  • Error codes and handling
  • Example message exchanges
  • JSON schema for configurations

3. Installation Instructions

Provide clear installation steps for:

  • Windows application installation
  • Required dependencies (.NET runtime)
  • USB driver installation (if needed)
  • Firmware update process (if required)
  • Verification steps

Technical Requirements

Firmware

  • Language: C++ (compatible with existing 86.7% C++, 13.3% C codebase)
  • Must integrate with existing OMOTE firmware architecture
  • Maintain backward compatibility
  • Optimize for ESP32 memory constraints
  • Follow existing code style and conventions

Windows Application

  • Language: C# with WPF
  • Target Windows 10/11
  • Include installer (MSI or setup.exe)
  • Handle graceful errors and disconnections
  • Support both light and dark themes (optional enhancement)

Configuration File Format

  • Use JSON for all configuration data
  • Schema version field for future compatibility
  • Human-readable formatting
  • Support comments in UI (strip before sending to device)

Deliverables

  1. ✅ Modified firmware files with serial configuration support
  2. ✅ Complete Windows WPF application source code
  3. ✅ Application installer/release build
  4. ✅ User guide document (Markdown or PDF)
  5. ✅ Protocol documentation (Markdown)
  6. ✅ Installation instructions (Markdown)
  7. ✅ Example configuration JSON files
  8. ✅ IR code database file
  9. ✅ README updates for the new features

Success Criteria

  • Firmware successfully receives and processes configuration commands
  • All settings can be read from and written to the device
  • Windows application successfully communicates with device
  • Configuration persists across device reboots
  • All validation works correctly
  • Documentation is clear and complete
  • Code follows existing project standards
  • No regression in existing firmware functionality

Additional Notes

  • Ensure the solution is production-ready
  • Include appropriate error handling throughout
  • Add logging for debugging purposes
  • Consider multi-language support for the Windows app (future enhancement)
  • Ensure the PR includes all necessary files and dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions