ble: read DIY barometer (BaroBalDav) over BLE + firmware
Self-made altitude sensor: ESP32-C3 SuperMini + BMP280 broadcasting pressure and temperature over standard BLE Environmental Sensing. Read into baldav the same way as the heart-rate strap (Kotlin BLE service -> file -> Rust -> JS), new device_type 'baro'. - BleHrService: 'baro' type subscribes to ESS 0x181A (pressure 0x2A6D uint32 0.1 Pa, temperature 0x2A6E int16 0.01 C), writes ble_baro_data.json + ble_baro_log.jsonl. Every baro branch is gated by deviceType=='baro', so HR/GPS paths are untouched. - ble.rs: BaroReading, ESS detection, ble_get_baro command (Android reads the file, desktop returns None). Registered in lib.rs. - frontend/js/baro.js: passive window.BARO - hypsometric pressure->altitude using the sensor temperature, anchored to GPS altitude at ride start. Nothing runs until BARO.start(), so with no barometer the app is unchanged. - tools/baro-sensor: firmware (PlatformIO main.cpp + Arduino sketch) that reads BMP280 at max oversampling and advertises the ESS service. Prep only: no hardware yet, verified by compile (build 0.1.538). Live wiring and ride-track integration pending the board.
This commit is contained in:
parent
1101016ef4
commit
82f3dc9d4a
9 changed files with 417 additions and 6 deletions
30
docs/session-logs/2026-10-30_barometer-ble-baldav.md
Normal file
30
docs/session-logs/2026-10-30_barometer-ble-baldav.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# 2026-10-30 - BLE-барометр: сторона baldav
|
||||
|
||||
## Контекст
|
||||
Делаем самодельный датчик высоты: ESP32-C3 SuperMini + BMP280, вещает давление и
|
||||
температуру по BLE (стандартный Environmental Sensing). Железо заказано, ещё едет.
|
||||
Прошивка датчика - в `tools/baro-sensor/` (PlatformIO + Arduino-скетч), схема сборки -
|
||||
`tools/baro-sensor/baro-guide.html`. Эта задача - прочитать датчик в baldav и считать высоту.
|
||||
|
||||
## Что сделано
|
||||
Читаем барометр тем же путём, что и пульсометр (Kotlin BLE-сервис -> файл -> Rust -> JS),
|
||||
новым `device_type = "baro"`. Диспетчер команд (`MainActivity`) не менялся - тип проходит насквозь.
|
||||
|
||||
- `BleHrService.kt`: тип `baro` - подписка на ESS (`0x181A`): давление `0x2A6D` (uint32, 0.1 Па)
|
||||
и температура `0x2A6E` (int16, 0.01 C). Пишет `ble_baro_data.json` + `ble_baro_log.jsonl`.
|
||||
Все ветки барометра под `deviceType == "baro"`; HR/GPS-пути не тронуты.
|
||||
- `ble.rs`: структура `BaroReading`, определение ESS, команда `ble_get_baro`
|
||||
(Android читает файл; десктоп возвращает None). Зарегистрирована в `lib.rs`.
|
||||
- `frontend/js/baro.js`: ПАССИВНЫЙ модуль `window.BARO`. Гипсометрический пересчёт давления
|
||||
в высоту с реальной температурой датчика, якорь к высоте GPS на старте. Ничего не исполняется,
|
||||
пока не вызван `BARO.start()` - без барометра приложение работает как раньше.
|
||||
|
||||
## Состояние
|
||||
Проверено компиляцией (сборка 0.1.538, без ошибок). На устройстве НЕ проверено - нет железа.
|
||||
|
||||
## Осталось (по приходу платы)
|
||||
- Активировать модуль: `BARO.start()` при подключении baro-устройства, задать `BARO.getGpsAlt`.
|
||||
- Привязать высоту барометра к треку поездки (в точки / поправка высот П.5).
|
||||
- UI: показать барометрическую высоту; выбор baro-устройства в scan-UI уже работает (тип проходит).
|
||||
- Ограничение: сервис держит одно BLE-соединение, поэтому барометр и пульсометр одновременно
|
||||
пока нельзя - отдельный следующий шаг (две связи / второй сервис).
|
||||
Loading…
Add table
Add a link
Reference in a new issue