chore: housekeeping
This commit is contained in:
@@ -3,52 +3,48 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Debug flags
|
||||
// debug flags
|
||||
#define DEBUG_MODE 1
|
||||
|
||||
// Device Bus Types
|
||||
typedef enum { BUS_RS485, BUS_ONEWIRE } bus_type_t;
|
||||
|
||||
// Device Type Definitions
|
||||
// device type definitions
|
||||
typedef enum {
|
||||
DEVICE_RELAY = 1,
|
||||
DEVICE_SOIL_SENSOR = 2,
|
||||
DEVICE_THERMOMETER = 3
|
||||
} device_type_t;
|
||||
|
||||
// Node Configuration
|
||||
// node configuration
|
||||
typedef struct {
|
||||
const char* id; // Unique identifier for the node
|
||||
const char* name; // Human readable name
|
||||
const char* location; // Optional location description
|
||||
uint8_t mac[6]; // MAC address
|
||||
} node_config_t;
|
||||
|
||||
// RS485 Device Configuration
|
||||
// RS485 device configuration
|
||||
typedef struct {
|
||||
uint8_t slave_id; // Modbus slave ID
|
||||
device_type_t type; // Type of device
|
||||
const char* name; // Device name (used in MQTT topics)
|
||||
} rs485_device_t;
|
||||
|
||||
// Network Configuration
|
||||
// Network configuration
|
||||
#define MQTT_SERVER_IP {192, 168, 102, 100}
|
||||
#define MQTT_PORT 1883
|
||||
|
||||
// MQTT Configuration
|
||||
// MQTT configuration
|
||||
#define MQTT_KEEP_ALIVE_INTERVAL 60
|
||||
#define MQTT_TX_BUFFER_SIZE 128
|
||||
#define MQTT_RX_BUFFER_SIZE 128
|
||||
#define MQTT_COMMAND_TIMEOUT_MS 1000
|
||||
|
||||
// Node Specific Configuration
|
||||
static const node_config_t NODE_CONFIG = {
|
||||
.id = "ch32-node1", .name = "CH32 Node 1", .location = "somewhere"};
|
||||
// node config declaration
|
||||
extern node_config_t NODE_CONFIG;
|
||||
|
||||
// RS485 Devices Configuration
|
||||
// RS485 devices configuration
|
||||
#define RS485_DEVICE_COUNT 1
|
||||
|
||||
static const rs485_device_t RS485_DEVICES[RS485_DEVICE_COUNT] = {
|
||||
{.slave_id = 0x01, .type = DEVICE_RELAY, .name = "relay-1"}};
|
||||
// {.slave_id = 0x02, .type = DEVICE_SOIL_SENSOR, .name = "soil-monitor-1"}};
|
||||
// RS485 devices declaration
|
||||
extern const rs485_device_t RS485_DEVICES[RS485_DEVICE_COUNT];
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
Reference in New Issue
Block a user