feat: production-ready firmware with BLE memory management, device_id fixes, and docs
- Reduce debug level to 1 (errors only) for production builds - Replace BLE pause/resume with full deinit/reinit during HTTP uploads (~25KB freed) - Add 60s boot report delay for fast post-deploy connectivity verification - Add device_id to BLE batch and heartbeat request bodies - Correct API host to http:// (plain HTTP, not HTTPS) - Add HTTP response logging and CV entry/exit serial logging - Create root README.md with operator setup and architecture overview - Update design spec: HMAC format, BLE memory approach, request body shapes, reporting intervals Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,10 +30,6 @@ static bool post_json(const DeviceConfig& cfg, const char* path, const String& b
|
||||
|
||||
HTTPClient http;
|
||||
String url = String(REPORTER_API_HOST) + path;
|
||||
// NOTE: Certificate validation is disabled — connection is encrypted but
|
||||
// server identity is not verified. To enable validation, use WiFiClientSecure
|
||||
// with setCACert() before calling http.begin(client, url).
|
||||
// Acceptable for this deployment: devices operate on store WiFi, not public internet.
|
||||
http.begin(url);
|
||||
http.addHeader("Content-Type", "application/json");
|
||||
http.addHeader("X-Device-Id", cfg.device_id);
|
||||
@@ -42,6 +38,7 @@ static bool post_json(const DeviceConfig& cfg, const char* path, const String& b
|
||||
|
||||
int code = http.POST(body);
|
||||
http.end();
|
||||
Serial.printf("[HTTP] POST %s → %d\n", url.c_str(), code);
|
||||
return (code == 200);
|
||||
}
|
||||
|
||||
@@ -64,6 +61,7 @@ static String build_camera_batch(const DeviceConfig& cfg,
|
||||
static String build_ble_batch(const DeviceConfig& cfg,
|
||||
const std::vector<BLEHourlyRecord>& recs) {
|
||||
JsonDocument doc;
|
||||
doc["device_id"] = cfg.device_id;
|
||||
doc["location_id"] = cfg.location_id;
|
||||
JsonArray arr = doc["records"].to<JsonArray>();
|
||||
for (const auto& r : recs) {
|
||||
@@ -151,6 +149,7 @@ void reporter_submit_ble(const DeviceConfig& cfg, const BLEHourlyRecord& rec) {
|
||||
|
||||
void reporter_heartbeat(const DeviceConfig& cfg, uint32_t uptime_s, int wifi_rssi) {
|
||||
JsonDocument doc;
|
||||
doc["device_id"] = cfg.device_id;
|
||||
doc["firmware_version"] = "1.0.0";
|
||||
doc["free_storage_pct"] = 100;
|
||||
doc["wifi_rssi"] = wifi_rssi;
|
||||
|
||||
Reference in New Issue
Block a user