HF-FDO2 Driver 0.1.0-dev
UART driver for PyroScience FDO2-G2 (data sheet v5 §4: #MOXY, #MRAW, #VERS)
Loading...
Searching...
No Matches
Quick start

You supply a CRTP adapter that inherits fdo2::UartInterface<YourType> and implements three calls: write, read, flush_rx. Optional delay_ms_impl helps with boot delays.

1. Wire and baud

  • Default UART after sensor power-up: 19200, 8N1, no handshake (data sheet §4).
  • Allow **~1 s** after power-up before the first command (kFdo2G2PowerUpSettleMs).

2. Minimal adapter (sketch)

#include "fdo2.hpp"
struct MyUart : fdo2::UartInterface<MyUart> {
void write(const uint8_t* d, size_t n);
size_t read(uint8_t* o, size_t m, uint32_t timeout_ms);
void flush_rx();
};
CRTP base for PSUP serial transport.
Definition fdo2_uart_interface.hpp:32
void write(const uint8_t *data, std::size_t length) noexcept
Definition fdo2_uart_interface.hpp:34
void flush_rx() noexcept
Definition fdo2_uart_interface.hpp:42
std::size_t read(uint8_t *out, std::size_t max, uint32_t timeout_ms) noexcept
Definition fdo2_uart_interface.hpp:38
Umbrella header for the HF-FDO2 (FDO2-G2) UART driver.

3. First measurements

MyUart uart;
dev.SetMeasureTimeoutMs(300);
auto v = dev.ReadVersion(); // #VERS D N R S
auto m = dev.MeasureMoxy(); // fastest: #MOXY O T S
// or: auto r = dev.MeasureMraw(); // adds pressure, RH, dphi, intensities
FDO2-G2 UART client.
Definition fdo2_driver.hpp:180

Decode fields are ready in MoxyReading / MrawReading (p_o2_hpa, temp_c, status_u32, …). Use fdo2::MoxyStatusOkForOxygen(s) to assert S ≤ 1 as recommended in the data sheet.

4. Volume % O₂

When membrane pressure matches the vent-side pressure from #MRAW P, use VolumePercentO2(p_o2_hpa, pressure_mbar) (see UART protocol).

Next: UART protocol →