sl-mechanical a2c554c232 cleanup: remove all Mamba/F722S/STM32F722 refs — replace with ESP32-S3 BALANCE/IO
- docs/: rewrite AGENTS.md, wiring-diagram.md (SAUL-TEE arch); update
  SALTYLAB.md, FACE_LCD_ANIMATION.md, board-viz.html, SALTYLAB-DETAILED refs
- cad/: dimensions.scad FC params → ESP32-S3 BALANCE params
- chassis/: ASSEMBLY.md, BOM.md, ip54_BOM.md, *.scad — FC_MOUNT_SPACING/
  FC_PITCH → TBD ESP32-S3; Drone FC → MCU mount throughout
- CLAUDE.md, TEAM.md: project desc → SAUL-TEE; hardware table → ESP32-S3/VESC
- USB_CDC_BUG.md: marked ARCHIVED (legacy STM32 era)
- AUTONOMOUS_ARMING.md: USB CDC → inter-board UART (ESP32-S3 BALANCE)
- projects/saltybot/SLAM-SETUP-PLAN.md: FC/STM32F722 → BALANCE/CAN
- jetson/docs/pinout.md, power-budget.md, README.md: STM32 bridge → CAN bridge
- jetson/config/RECOVERY_BEHAVIORS.md: FC+Hoverboard → BALANCE+VESC
- jetson/ros2_ws: stm32_protocol.py → esp32_protocol.py,
  stm32_cmd_node.py → esp32_cmd_node.py,
  mamba_protocol.py → balance_protocol.py; can_bridge_node imports updated
- scripts/flash_firmware.py: DFU/STM32 → pio run -t upload
- src/ include/: ARCHIVED headers added (legacy code preserved)
- test/: ARCHIVED notices; STM32F722 comments marked LEGACY
- ui/diagnostics_panel.html: Board/STM32 → ESP32-S3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 09:06:09 -04:00

68 lines
2.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ARCHIVED: Legacy STM32F722/Mamba F722S era code. NOT used in current hardware. */
#ifndef BARO_H
#define BARO_H
#include <stdint.h>
#include <stdbool.h>
/*
* baro — BME280/BMP280 barometric pressure & ambient temperature module
* (Issue #672).
*
* Reads pressure and temperature from the BME280 at BARO_READ_HZ (1 Hz),
* computes pressure altitude using the ISA barometric formula, and publishes
* JLINK_TLM_BARO (0x8D) telemetry to the Orin at BARO_TLM_HZ (1 Hz).
*
* Runs entirely on the Mamba F722S — no Orin dependency.
* Altitude is exposed via baro_get_alt_cm() for use by slope compensation
* in the balance PID (Issue #672 requirement).
*
* Usage:
* 1. Call i2c1_init() then bmp280_init() and pass the chip_id result.
* 2. Call baro_tick(now_ms) every ms from the main loop.
* 3. Call baro_get_alt_cm() to read the latest altitude.
*/
/* ---- Configuration ---- */
#define BARO_READ_HZ 1u /* sensor poll rate (Hz) */
#define BARO_TLM_HZ 1u /* JLink telemetry rate (Hz) */
/* ---- Data ---- */
typedef struct {
int32_t pressure_pa; /* barometric pressure (Pa) */
int16_t temp_x10; /* ambient temperature (°C × 10; e.g. 235 = 23.5 °C) */
int32_t alt_cm; /* pressure altitude above ISA sea level (cm) */
int16_t humidity_pct_x10; /* %RH × 10 (BME280 only); -1 if BMP280/absent */
bool valid; /* true once at least one reading has been obtained */
} baro_data_t;
/* ---- API ---- */
/*
* baro_init(chip_id) — register chip type from bmp280_init() result.
* chip_id : 0x58 = BMP280, 0x60 = BME280, 0 = absent/not found.
* Call after i2c1_init() and bmp280_init(); no-op if chip_id == 0.
*/
void baro_init(int chip_id);
/*
* baro_tick(now_ms) — rate-limited sensor read + JLink telemetry publish.
* Call every ms from the main loop. No-op if chip absent.
* Reads at BARO_READ_HZ; sends JLINK_TLM_BARO at BARO_TLM_HZ.
*/
void baro_tick(uint32_t now_ms);
/*
* baro_get(out) — copy latest baro data into *out.
* Returns true on success; false if no valid reading yet.
*/
bool baro_get(baro_data_t *out);
/*
* baro_get_alt_cm() — latest pressure altitude (cm above ISA sea level).
* Returns 0 if no valid reading. Used by slope compensation in balance PID.
*/
int32_t baro_get_alt_cm(void);
#endif /* BARO_H */