code wiki / (root) / nx_env_sample.nx

nx_env_sample.nx

buildroot/runtime/nx_env_sample.nx

6104 B141 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind orphan librarytopic env
docsdependenciesstructsconstsfunctions

about

nx_env_sample.nx -- environmental sensor sample container. license_tier: PUBLIC_NISHI_SUBSTRATE genealogy_id: govee_h5179_lan_protocol_2024 + sensirion_sht45_datasheet + atlas_scientific_ezo_circuit_protocols + nishi_iot_local_substrate_2026 Not to be confused with nx_env.nx (shell envp lookup) -- different concern. This is a single environmental telemetry reading from a physical sensor in the grow space, reservoir, or storage container. Generic enough to live in nishi-core: any project that ingests sensor data (industrial IoT, weather station, biology lab, growroom) uses this same struct shape. ===== Provenance ================================================ Sealed source_kind enum: distinguishes where the reading came from. Drives data-quality verdict downstream -- a manual reading has different trust + frequency than a continuous BLE-logger trace.

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_env_sample.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

structs

53struct EnvSample

consts

32const NX_ENV_SOURCE_BLE_LOGGER: i64 = 1 // Govee H5179 / SensorPush HT.w continuous
33const NX_ENV_SOURCE_IOT_RELAY: i64 = 2 // nx_iot_local_grow_relay polling
34const NX_ENV_SOURCE_INLINE_PROBE: i64 = 3 // EC/pH/DO directly wired to controller
35const NX_ENV_SOURCE_MANUAL: i64 = 4 // grower hand-entered reading
36const NX_ENV_SOURCE_LAB_RETURN: i64 = 5 // mail-in lab result (Logan/Ward/UMass)
49const NX_ENV_UNSET: i64 = -9223372036854775808
73const NX_ENV_SAMPLE_BYTES: i64 = 96 // 12 fields * 8 bytes
76const NX_ENV_QUALITY_TRUSTED: i64 = 1
77const NX_ENV_QUALITY_FLAGGED_RANGE: i64 = 2 // reading outside plausible range
78const NX_ENV_QUALITY_FLAGGED_STALE: i64 = 3 // older than max-silence threshold
79const NX_ENV_QUALITY_DUPLICATE: i64 = 4 // same reading reported twice
115const NX_ENV_TEMP_MIN_Q10: i64 = -30720 // -30 C
116const NX_ENV_TEMP_MAX_Q10: i64 = 61440 // 60 C
117const NX_ENV_RH_MIN_Q10: i64 = 0
118const NX_ENV_RH_MAX_Q10: i64 = 102400 // 100% in Q10
119const NX_ENV_PH_MIN_Q10: i64 = 0
120const NX_ENV_PH_MAX_Q10: i64 = 14336 // 14 in Q10
121const NX_ENV_EC_MAX_Q10: i64 = 10240000 // 10000 uS/cm

functions

38func nx_env_source_kind_name(s: i64) -> *u8
81func nx_env_quality_name(v: i64) -> *u8
91func nx_env_sample_new(container_id: i64, ts_unix: i64, source_kind: i64, sensor_id: i64) -> *EnvSample
calls 1: sys_mmap
123func nx_env_sample_check_range(s: *EnvSample) -> i64