STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_hp_pt_code.cpp File Reference
#include <cstdint>
#include <cstdio>
#include <initializer_list>
#include "calibration/HpPtCode.hpp"
Include dependency graph for test_hp_pt_code.cpp:

Go to the source code of this file.

Macros

#define CHECK(cond, ...)

Functions

static double volts (uint32_t code)
 Shunt volts for a code, as calibration_main's convert_hp_pt_to_pressure computes it.
static void live_negative_code_is_no_current ()
static void every_negative_code_is_zero ()
static void live_loop_codes_pass_through ()
int main ()
uint32_t hp_pt_shunt_code (uint32_t wire)
 Unit tests for fsw::calibration::hp_pt_shunt_code (4-20 mA PT wire code coercion).

Variables

static int g_failures = 0

Macro Definition Documentation

◆ CHECK

#define CHECK ( cond,
... )
Value:
do { \
if (!(cond)) { \
std::printf(" ❌ [%s:%d] ", __func__, __LINE__); \
std::printf(__VA_ARGS__); \
std::printf("\n"); \
} \
} while (0)
static int g_failures

Definition at line 19 of file test_hp_pt_code.cpp.

Referenced by every_negative_code_is_zero(), live_loop_codes_pass_through(), and live_negative_code_is_no_current().

Function Documentation

◆ every_negative_code_is_zero()

void every_negative_code_is_zero ( )
static

Definition at line 44 of file test_hp_pt_code.cpp.

References CHECK, and hp_pt_shunt_code().

Referenced by main().

◆ hp_pt_shunt_code()

uint32_t fsw::calibration::hp_pt_shunt_code ( uint32_t wire)
inline

Unit tests for fsw::calibration::hp_pt_shunt_code (4-20 mA PT wire code coercion).

House style: plain main(), return 0 on pass / 1 on failure. Registered in lib/CMakeLists.txt.

The headline case is the code captured live on 2026-11-07 from HPD-PT (PT board 2 ch3): 0xFFFF0FB5, a small negative ADC reading that the old coercion clamped to full scale.

Definition at line 23 of file HpPtCode.hpp.

Referenced by every_negative_code_is_zero(), live_loop_codes_pass_through(), and live_negative_code_is_no_current().

◆ live_loop_codes_pass_through()

void live_loop_codes_pass_through ( )
static

Definition at line 49 of file test_hp_pt_code.cpp.

References CHECK, and hp_pt_shunt_code().

Referenced by main().

◆ live_negative_code_is_no_current()

void live_negative_code_is_no_current ( )
static

Definition at line 34 of file test_hp_pt_code.cpp.

References CHECK, hp_pt_shunt_code(), and volts().

Referenced by main().

◆ main()

◆ volts()

double volts ( uint32_t code)
static

Shunt volts for a code, as calibration_main's convert_hp_pt_to_pressure computes it.

Definition at line 30 of file test_hp_pt_code.cpp.

Referenced by code_at(), fsw::t7::lc_kg(), live_negative_code_is_no_current(), main(), fsw::t7::pt_psi(), fsw::t7::rtd_c(), fsw::t7::rtd_ohms(), fsw::t7::t7_counts(), and fsw::t7::tc_c().

Variable Documentation

◆ g_failures

int g_failures = 0
static

Definition at line 17 of file test_hp_pt_code.cpp.