NetBurner 3.5.6
PDF Version
Config Class

Config Class Application

Overview

This NetBurner application demonstrates the use of the config system for creating and managing persistent configuration variables. The config system provides a way to store both system-defined settings (like network configuration) and user-defined custom variables that persist across power cycles.

Features

  • Custom Config Classes: Demonstrates inheritance from config_obj to create structured configuration objects
  • Persistent Storage: All configuration values are automatically saved to non-volatile storage
  • Interactive Menu System: Serial port interface for viewing and modifying configuration values
  • Config Tree Visualization: Display the complete configuration hierarchy
  • Network Integration: Shows network interface information on startup

Architecture

Config Object Types

The application uses several NetBurner config object types:

Class Hierarchy

The application defines a hierarchy of config classes:

- TempRange
- m_maxTemp (default: 100)
- m_setTemp (default: 30)
- m_minTemp (default: 10)
- Thermostat (inherits from TempRange)
- m_tempRec1 (default: 101)
- m_tempRec2 (default: 102)
- m_active (default: true)
- m_location (default: "Warehouse 1")
- m_tempScale (default: "Fahrenheit")
Base class used to create configuration objects.
Definition config_obj.h:320

Key Classes

TempRange

Base class for temperature-related configuration:

  • m_maxTemp: Maximum temperature setting
  • m_setTemp: Target temperature setting
  • m_minTemp: Minimum temperature setting

Thermostat

Extended thermostat configuration inheriting from TempRange:

  • m_tempRec1 and m_tempRec2: Temperature recording values
  • m_active: Enable/disable flag
  • m_location: Physical location description
  • m_tempScale: Temperature scale selection (Fahrenheit/Celsius/Kelvin)

cfg_class_slot and cfg_class_slots

Example classes for slot-based configuration:

  • cfg_class_slot: Individual slot with enabled flag and name
  • cfg_class_slots: Container for multiple slot configurations

Serial Interface Commands

The application provides an interactive menu system accessible via serial port:

Command Description
C Show complete config tree
L Show and set thermostat location
M Show and set thermostat max temperature
N Show and set thermostat min temperature
S Show and set thermostat set temperature
T Show thermostat recorded temperatures
? Show command list

Usage

  1. Power On: The application initializes the network interface and displays network information
  2. Menu Access: Connect to the serial port and press ? to see available commands
  3. Configuration: Use the menu commands to view and modify configuration values
  4. Persistence: All changes are automatically saved to non-volatile storage

Network Information

On startup, the application displays:

  • Current IP address
  • AutoIP address
  • Gateway address
  • Build timestamp

Important Notes

Config Object Rules

  1. Unique Names: Each config object must have a unique name to avoid conflicts in the config tree
  2. Global Scope: Config objects should be declared at global scope for proper initialization
  3. ConfigEndMarker: Must be placed after all config data members in each class
  4. Default Values: All config members should be given appropriate default values

Build Information

  • Application Name: ConfigClass
  • Build Date/Time: Displayed on startup
  • Platform: NetBurner embedded system

Dependencies

The application requires the following NetBurner libraries:

Development Notes

This example builds upon the BasicConfigVariable example and demonstrates more advanced config system usage with custom classes and inheritance. It serves as a foundation for applications requiring persistent configuration management with structured data organization.