Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
// Device Identity
// ============================================================================
#define CLIENT_ID "tanksensor"
#define DEVICE_VERSION "v1.0.0"
#define DEVICE_VERSION "v2.0.0"
#define MDNS_HOSTNAME "dusa"
#define OTA_PORT 80

// ============================================================================
// ADC Configuration
// ============================================================================
#define ADC_RESOLUTION 12 // 12-bit ADC (0-4095)
#define ADC_MAX 4095
#define ADC_VREF 3.3f

// ADC reading parameters
#define ADC_SAMPLES 64 // Number of samples to average
Expand All @@ -63,7 +63,6 @@
// ============================================================================
#define READ_INTERVAL_MS 5000 // Read ADC every 5 seconds
#define PUBLISH_INTERVAL_MS 30000 // Publish to MQTT every 30 seconds
#define HEARTBEAT_INTERVAL_MS 60000 // Keepalive every 60 seconds

// Connection timeouts
#define WIFI_CONNECT_TIMEOUT_MS 30000 // WiFi connection timeout
Expand All @@ -74,6 +73,9 @@
#define WIFI_RECONNECT_DELAY_MS 5000 // Delay between WiFi reconnect attempts
#define MQTT_RECONNECT_DELAY_MS 2000 // Delay between MQTT reconnect attempts

// Watchdog
#define WDT_TIMEOUT_S 30 // Hardware watchdog timeout (seconds)

// ============================================================================
// Pin Assignments (XIAO ESP32-S3)
// ============================================================================
Expand Down
23 changes: 20 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
; PlatformIO configuration for ESP32-S3 Tank Sensor
;
;
; To use: pio run -t upload
; Monitor: pio device monitor

[env:xiao_esp32s3]
[platformio]
default_envs = xiao_esp32s3

[env]
platform = espressif32
board = seeed_xiao_esp32s3
framework = arduino
Expand All @@ -12,15 +15,29 @@ framework = arduino
monitor_speed = 115200

; Library dependencies
lib_deps =
lib_deps =
knolleary/PubSubClient@^2.8
bblanchon/ArduinoJson@^7.0.0
GxProjectorClient=https://github.com/nuketownada/gx-projector-client.git#v0.1.0

; Build flags
; Set credentials via environment variables:
; WIFI_SSID=MyNetwork WIFI_PASS=secret pio run
build_flags = -DARDUINO_USB_CDC_ON_BOOT=1

; ============================================================================
; USB Upload (default) - for initial flash or when device is local
; ============================================================================
[env:xiao_esp32s3]
; Upload settings (adjust port as needed)
; upload_port = /dev/ttyACM0 ; Linux
; upload_port = COM3 ; Windows

; ============================================================================
; HTTP OTA Upload - for remote updates (board must run OTA-capable firmware)
; Usage: pio run -e ota -t upload
; ============================================================================
[env:ota]
; Custom upload via HTTP POST (mDNS name from MDNS_HOSTNAME, port 80)
upload_protocol = custom
upload_command = curl --fail --show-error --progress-bar -X POST -F "firmware=@$SOURCE" http://dusa.local/update
Loading