nx_env_sample.nx
buildroot/runtime/nx_env_sample.nx
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
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
structs
| 53 | struct EnvSample |
consts
| 32 | const NX_ENV_SOURCE_BLE_LOGGER: i64 = 1 // Govee H5179 / SensorPush HT.w continuous |
| 33 | const NX_ENV_SOURCE_IOT_RELAY: i64 = 2 // nx_iot_local_grow_relay polling |
| 34 | const NX_ENV_SOURCE_INLINE_PROBE: i64 = 3 // EC/pH/DO directly wired to controller |
| 35 | const NX_ENV_SOURCE_MANUAL: i64 = 4 // grower hand-entered reading |
| 36 | const NX_ENV_SOURCE_LAB_RETURN: i64 = 5 // mail-in lab result (Logan/Ward/UMass) |
| 49 | const NX_ENV_UNSET: i64 = -9223372036854775808 |
| 73 | const NX_ENV_SAMPLE_BYTES: i64 = 96 // 12 fields * 8 bytes |
| 76 | const NX_ENV_QUALITY_TRUSTED: i64 = 1 |
| 77 | const NX_ENV_QUALITY_FLAGGED_RANGE: i64 = 2 // reading outside plausible range |
| 78 | const NX_ENV_QUALITY_FLAGGED_STALE: i64 = 3 // older than max-silence threshold |
| 79 | const NX_ENV_QUALITY_DUPLICATE: i64 = 4 // same reading reported twice |
| 115 | const NX_ENV_TEMP_MIN_Q10: i64 = -30720 // -30 C |
| 116 | const NX_ENV_TEMP_MAX_Q10: i64 = 61440 // 60 C |
| 117 | const NX_ENV_RH_MIN_Q10: i64 = 0 |
| 118 | const NX_ENV_RH_MAX_Q10: i64 = 102400 // 100% in Q10 |
| 119 | const NX_ENV_PH_MIN_Q10: i64 = 0 |
| 120 | const NX_ENV_PH_MAX_Q10: i64 = 14336 // 14 in Q10 |
| 121 | const NX_ENV_EC_MAX_Q10: i64 = 10240000 // 10000 uS/cm |
functions
| 38 | func nx_env_source_kind_name(s: i64) -> *u8 |
| 81 | func nx_env_quality_name(v: i64) -> *u8 |
| 91 | func nx_env_sample_new(container_id: i64, ts_unix: i64, source_kind: i64, sensor_id: i64) -> *EnvSample calls 1: sys_mmap |
| 123 | func nx_env_sample_check_range(s: *EnvSample) -> i64 |