Files
leehughesandClaude Opus 4.5 5554341b49 Add LoRa sensor network support
- Design LoRa packet protocol with CRC16 validation
- Add protocol header files (lora_protocol.h, lora_packet.h)
- Create battery-powered remote node firmware template
  - Support for DHT22, BME680, DS18B20 sensors
  - Deep sleep for battery conservation
  - Automatic gateway registration
- Add LoRa receive to gateway firmware
  - RadioLib SX1262 integration
  - Node registry for tracking up to 16 nodes
  - HTTP forwarding of received readings
  - ACK responses to remote nodes
- Create comprehensive setup guide with wiring diagrams

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 17:50:53 -06:00

104 lines
3.0 KiB
C

/**
* ZNET Temperature Sensor Configuration
*
* Edit these values for your installation.
*/
#ifndef CONFIG_H
#define CONFIG_H
// ============================================================================
// NETWORK CONFIGURATION
// ============================================================================
// WiFi credentials (can also be set via WiFiManager portal)
#define WIFI_SSID "" // Leave empty to use WiFiManager
#define WIFI_PASSWORD ""
// ZNET Web API endpoint
#define ZNET_API_URL "http://192.168.1.100:8000/api/v1/sensors/readings"
// Device identification
#define DEVICE_ID "tank_gateway_1"
#define DEVICE_NAME "E-Coat Tank Gateway"
// ============================================================================
// SENSOR CONFIGURATION
// ============================================================================
// DS18B20 1-Wire data pin
#ifndef ONEWIRE_PIN
#define ONEWIRE_PIN 7
#endif
// Temperature reading interval (milliseconds)
#define TEMP_READ_INTERVAL_MS 30000 // 30 seconds
// Number of readings to average for stability
#define TEMP_AVG_READINGS 3
// Sensor IDs (auto-detected, but can be named)
#define SENSOR_1_NAME "tank_primary"
#define SENSOR_2_NAME "tank_secondary"
// Temperature validation range (Fahrenheit)
#define TEMP_MIN_VALID_F 32.0
#define TEMP_MAX_VALID_F 150.0
// ============================================================================
// DISPLAY CONFIGURATION
// ============================================================================
// OLED I2C address
#define OLED_ADDRESS 0x3C
// Display update interval (milliseconds)
#define DISPLAY_UPDATE_INTERVAL_MS 1000
// ============================================================================
// LORA CONFIGURATION (for remote sensor nodes)
// ============================================================================
// LoRa frequency (915 MHz for US, 868 MHz for EU)
#define LORA_FREQUENCY 915.0
// LoRa bandwidth in kHz (125, 250, or 500)
#define LORA_BANDWIDTH 125000 // 125 kHz
// LoRa spreading factor (7-12, higher = longer range but slower)
#define LORA_SPREADING_FACTOR 9
// LoRa coding rate (5-8, higher = more error correction)
#define LORA_CODING_RATE 7
// LoRa sync word (must match remote nodes: 0x12)
#define LORA_SYNC_WORD 0x12
// Maximum remote nodes to track
#define MAX_LORA_NODES 16
// ============================================================================
// API RETRY CONFIGURATION
// ============================================================================
// Maximum retries for API calls
#define API_MAX_RETRIES 3
// Retry delay (milliseconds)
#define API_RETRY_DELAY_MS 5000
// HTTP timeout (milliseconds)
#define HTTP_TIMEOUT_MS 10000
// ============================================================================
// BUFFER CONFIGURATION (for offline operation)
// ============================================================================
// Maximum readings to buffer when offline
#define OFFLINE_BUFFER_SIZE 100
// Save buffer to flash on reboot
#define BUFFER_PERSIST_TO_FLASH true
#endif // CONFIG_H