STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
HpPtCode.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
5
namespace
fsw::calibration
{
6
7
/**
8
* A 4-20 mA PT's wire code -> the shunt code the conversions and calibrations work in.
9
*
10
* The code is full scale at 2^31 against the 2.5 V internal reference, and the loop at
11
* 20 mA across 120 Ohm is 2.4 V, so every reading a live loop can produce sits in
12
* [0, 2^31). A code at or above 2^31 is the ADC's two's-complement NEGATIVE: the shunt
13
* below 0 V, which is what an open or unpowered loop's noise does around zero.
14
*
15
* It used to be clamped to 2^31-1 instead -- full scale, 20 mA, 5000 psi. On 2026-11-07
16
* COPV-PT-R and HPD-PT (PT board 2, connectors 1 and 3, both reading ~0 mA) produced
17
* codes like 0xFFFF0FB5 (-61515) a few times a minute; each became a 5000 psi sample,
18
* the output EMA turned it into a 1250 psi pulse decaying over ~1 s, and the controller
19
* and the plots both received it.
20
*
21
* A negative code reads as no current: 0, which the conversion reports as 0 psi.
22
*/
23
inline
uint32_t
hp_pt_shunt_code
(uint32_t wire) {
24
return
wire > 0x7FFFFFFFu ? 0u : wire;
25
}
26
27
}
// namespace fsw::calibration
fsw::calibration
Output smoothing for calibrated PT pressure, per sensor uid (ESP32 and LabJack T7 alike).
Definition
AllanVariance.hpp:8
fsw::calibration::hp_pt_shunt_code
uint32_t hp_pt_shunt_code(uint32_t wire)
A 4-20 mA PT's wire code -> the shunt code the conversions and calibrations work in.
Definition
HpPtCode.hpp:23
daq-server
diablo_server
lib
include
calibration
HpPtCode.hpp
Generated by
1.15.0