From 1e00df61405b42067224afb10c68a136eab29dbb Mon Sep 17 00:00:00 2001 From: erdilrf-afk Date: Tue, 17 Nov 2026 03:00:13 -0800 Subject: [PATCH] Add CAN and I2C interface selection guides Reuse manufacturer-sourced dataset. Preserve full range conditions, omit price columns on new guides, add regression checks. Local validation: 179 rows, 0 problems; build: 27 pages; pytest: 16 passed. --- .../can-bus-rangefinder-modules/index.html | 44 ++++++++++++ .../guides/i2c-rangefinder-modules/index.html | 68 +++++++++++++++++++ docs/guides/index.html | 2 +- docs/llms.txt | 2 + docs/sitemap.xml | 2 + scripts/build_views.py | 37 +++++++++- tests/test_interface_guides.py | 27 ++++++++ 7 files changed, 178 insertions(+), 4 deletions(-) create mode 100644 docs/guides/can-bus-rangefinder-modules/index.html create mode 100644 docs/guides/i2c-rangefinder-modules/index.html create mode 100644 tests/test_interface_guides.py diff --git a/docs/guides/can-bus-rangefinder-modules/index.html b/docs/guides/can-bus-rangefinder-modules/index.html new file mode 100644 index 0000000..a244d01 --- /dev/null +++ b/docs/guides/can-bus-rangefinder-modules/index.html @@ -0,0 +1,44 @@ + + +Laser rangefinder modules with a published CAN interface + + + + + + + + +

Laser rangefinder modules with a published CAN interface

+

13 modules from 4 manufacturers (Benewake, DFRobot, Lumispot Tech, Nooploop) match: category is rangefinder module, published interface includes CAN, published max range is present, and status is not discontinued; unknown status remains unknown. Data date 2026-11-17; every row links to the manufacturer page the values were copied from.

+

What to check

+

Matching modules (13)

+
+ + + + + + + + + + + + + +
BrandModelnmMax rangeRange conditionMin mAccuracyRateInterfaceWeight gOpen-source driverSource
BenewakeTF02-i85040 m90% reflectivity (0.1~13.5 m @10%); same outdoors 100 Klux0.1±5 cm @ 0.1-5 m; ±1% @ 5-25 m1 ~ 1000 HzCAN, RS-48560ArduPilot AP_RangeFindersource 2026-11-17
BenewakeTF03-100/180905180 mTF03-180: 180 m @ 90% ref.; TF03-100: 100 m @ 90% ref. (70 m / 40 m @ 10%)0.1±10 cm (<10 m); 1% (≥10 m)1 ~ 9800 HzUART, CAN, RS-232, RS-48586ArduPilot AP_RangeFindersource 2026-11-17
BenewakeTF350905350 mindoor, no ambient light, 90% reflectivity (outdoor @100Klux: 300 m @90%)0.2±10 cm (within 10 m); 1% (10 m and further)1 ~ 1000 HzUART, CAN, RS-232, RS-485224ArduPilot AP_RangeFindersource 2026-11-17
BenewakeTFA300905270 m90% reflectivity, 100 KLux (150 m @ 30%, 90 m @ 10%, same conditions)0.1±10 cm (<10 m); 1% (≥10 m)1-10,000 Hz configurable (default 50 Hz)UART, CAN (switchable by command)34.5source 2026-11-17
BenewakeTFA300-L905290 m90% reflectivity, 100 KLux (170 m @ 30%, 100 m @ 10%, same conditions)0.1±10 cm (<10 m); 1% (≥10 m)1-10,000 Hz configurable (default 50 Hz)UART, CAN (switchable by command)10.5source 2026-11-17
BenewakeTFmini-i85012 m90% reflectivity (0.1~7 m @10%); same outdoors 70 Klux0.1±6 cm @ 0.1-6 m; ±1% @ 6-12 m1 ~ 1000 HzCAN, RS-48552source 2026-11-17
DFRobotSEN0337 TOF Sense Laser Range Sensor (5m)9405 mlong-range mode0.01Long-range: accuracy±1.5cm, standard deviation<0.5cm@[0.01,3]m range, standard deviation<8cm@[3,5]m range10Hz update rateUART, CAN2.7source 2026-11-17
Lumispot TechELRF-C16 (Micro 3KM class)15355 km>=5km large target (building); >=3.2km vehicle; >=2km person; >=1km UAV15<=±1m1~10HzRS422 serial, CAN (TTL optional)33source 2026-11-17
Lumispot TechELRF-E16 (Micro 5KM class)15356 km≥6km (large target: building); ≥5km vehicle 2.3m×2.3m; ≥3km person 1.7m×0.5m; visibility ≥20km, humidity ≤80%15≤±1m1~10HzRS422 serial, CAN (TTL optional)40source 2026-11-17
NooploopTOFSense9408 m0.03±1.5cm@[0.03, 1.0]m; ±3.0cm@(1.0, 8.0]m30HzUART, CAN, I/O2.7ArduPilot AP_RangeFindersource 2026-11-17
NooploopTOFSense S9408 m0.03±1.5cm@[0.03, 1.0]m; ±3.0cm@(1.0, 8.0]m30HzUART, CAN5.8ArduPilot AP_RangeFindersource 2026-11-17
NooploopTOFSense-M (8x8 / 4x4 array)9404 m600 LUX ambient0.015±1.5cm; standard deviation<1.0cm15Hz@8*8; 60Hz@4*4UART, CAN2.8Nooploop source download (TOFSense_M_Arduino_Driver_V1_0.zip)source 2026-11-17
NooploopTOFSense-M S (8x8 array)9404 m0.015~4.00 m @600 LUX ambient (2.00 m @60K LUX; 1.20 m @100K LUX)0.015±1.5cm15Hz@8*8; 60Hz@4*4UART, CAN5.8source 2026-11-17
+ + diff --git a/docs/guides/i2c-rangefinder-modules/index.html b/docs/guides/i2c-rangefinder-modules/index.html new file mode 100644 index 0000000..99edb53 --- /dev/null +++ b/docs/guides/i2c-rangefinder-modules/index.html @@ -0,0 +1,68 @@ + + +Laser rangefinder modules with a published I2C interface + + + + + + + + +

Laser rangefinder modules with a published I2C interface

+

37 modules from 6 manufacturers (Benewake, DFRobot, ERDI, Garmin, LightWare, Nooploop) match: category is rangefinder module, published interface includes I2C, IIC or I²C, published max range is present, and status is not discontinued; unknown status remains unknown. Data date 2026-11-17; every row links to the manufacturer page the values were copied from.

+

What to check

+

Matching modules (37)

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BrandModelnmMax rangeRange conditionMin mAccuracyRateInterfaceWeight gOpen-source driverSource
BenewakeTF-Luna8508 m90% reflectivity indoor 0 klux (also 90% outdoor 90 klux); 0.2~2.5 m @10%0.2± 6 cm @ (0.2 ~ 3 m)1 ~ 250 HzUART, I/O, I²C5ArduPilot AP_RangeFindersource 2026-11-17
BenewakeTF-Luna-UW8500.55 munderwater, clear water, 50% reflectivity target (common tile) at 25 C, indoor0.1< ±3 cm100 Hz default (up to 250 Hz; 500/n Hz configurable)UART, I²Csource 2026-11-17
BenewakeTF-NOVA90514 m90% reflectivity, 0 Klux (13 m @10%; 7 m @90% and 4 m @10% at 100 Klux)0.1±5 cm @ 0.1-4 m1 ~ 900 HzUART, I/O, I²CArduPilot AP_RangeFindersource 2026-11-17
BenewakeTF-UW5005 munderwater, indoor, NTU<0.5, 30% reflectivity, beam perpendicular to target (datasheet gives range as >5 m)0.1< 3 cm @ 0.1-2 m20 Hz (default)UART, I²C (switchable by command)source 2026-11-17
BenewakeTF02-Pro85040 m90% reflectivity0.1±5 cm @ 0.1-5 m; ±1% @ 5-40 m1 ~ 1000 HzUART, I/O, I²C50ArduPilot AP_RangeFindersource 2026-11-17
BenewakeTF02-Pro-W85025 m90% reflectivity (0.1~12 m @ 10% reflectivity); same indoor 0 Klux and outdoor 100 Klux0.1±6 cm @ 0.1-6 m; ±1% @ 6-25 m1-1000 Hz adjustable (default 100 Hz)UART, I²C90source 2026-11-17
BenewakeTFS20-L90520 m90% reflectivity @ 0 Klux (15 m @90%, 100 Klux; 12 m @10%, 0 Klux)0.2±6 cm (0.2~6 m); 1% (>6 m)1 ~ 250 HzUART, I²C1.35ArduPilot AP_RangeFindersource 2026-11-17
BenewakeTFmini Plus85012 m90% reflectivity (0.1~4 m @10%); same at 70 Klux0.1± 5 cm @ (0.1 ~ 5 m)1 ~ 1000 HzUART, I/O, I²C12ArduPilot AP_RangeFindersource 2026-11-17
BenewakeTFmini-S85012 m90% reflectivity (0.1~7 m @10%); same at 70 Klux0.1± 6 cm within 0.1 ~ 6 m1 ~ 1000 HzUART, I/O, I²C5source 2026-11-17
DFRobotSEN0309 TFmini Plus ToF LiDAR Sensor85012 m0.1±5 cm (0.1m-6 m); ±1% (6m-12 m)1-1000 Hz (adjustable)UART, I2C, I/O12DFRobot_TF_Mini_Laser_Range_Finder (GitHub, Arduinolibrary), ArduPilot AP_RangeFindersource 2026-11-17
DFRobotSEN0590 Mini Laser Distance Range Sensor (4m)4 m0.02≤25cm@±1cm, >25cm@±S*4%cm (with an actual error of around 5mm)Output response time 19-38msI2Csource 2026-11-17
DFRobotSEN0648 50m TOF Laser Ranging Sensor90550 mdepends on environment reflectivity0.05±3cm100HzUART, IIC, I/O7.5source 2026-11-17
DFRobotSEN0755 TF-UW500 Underwater Single-Point LiDAR5 munderwater, indoors, NTU <0.5, 30% reflectivity, vertical incidence (published as >5m)0.1< 3cm (0.1 ~ 2m)Default 20HzUART / I2C (switchable via command)source 2026-11-17
ERDILRF100H905100 m0.05–100 m (90% reflectivity); 0.05–30 m (10% reflectivity) (The two source values remain bound to their stated target reflectivity.)0.05±10 cm (<10 m); 1% (≥10 m)20 Hz-10 kHz (default: 1 kHz)UART, IIC20erdi-lrf-drivers (Python, ROS 2), ErdiLRF (Arduino)source 2026-11-12
ERDILRF1500H9051.5 km0.05–1,500 m (90% reflectivity); 0.05–300 m (10% reflectivity) (The two source values remain bound to their stated target reflectivity.)0.05±10 cm (<10 m); 1% (≥10 m)1 kHz or 50 Hz (automatically switched to match reflected-signal intensity)UART/IIC20erdi-lrf-drivers (Python, ROS 2), ErdiLRF (Arduino)source 2026-11-12
ERDILRF200H905200 m0.05–200 m (90% reflectivity); 0.05–70 m (10% reflectivity) (The two source values remain bound to their stated target reflectivity.)0.05±10 cm (<10 m); 1% (≥10 m)20 Hz-10 kHz (default: 1 kHz)UART, IIC20erdi-lrf-drivers (Python, ROS 2), ErdiLRF (Arduino)source 2026-11-12
ERDILRF22VB90520 m0.05–20 m (90% reflectivity); 0.05–10 m (10% reflectivity) (The two source values remain bound to their stated target reflectivity.)0.05±5 cm (<5 m); 1% (≥5 m)200 Hz (alternatives: 100/50/20/10/1 Hz)UART/IIC1.5erdi-lrf-drivers (Python, ROS 2), ErdiLRF (Arduino)source 2026-11-12
ERDILRF300H905300 m0.05–300 m (90% reflectivity); 0.05–100 m (10% reflectivity) (The two source values remain bound to their stated target reflectivity.)0.05±10 cm (<10 m); 1% (≥10 m)1 kHz or 50 Hz (automatically switched to match reflected-signal intensity)UART, IIC20erdi-lrf-drivers (Python, ROS 2), ErdiLRF (Arduino)source 2026-11-12
ERDILRF50VB90550 m0.05–50 m (90% reflectivity); 0.05–20 m (10% reflectivity) (The two source values remain bound to their stated target reflectivity.)0.05±5 cm (<5 m); 1% (≥5 m)100 HzUART/IIC1.3erdi-lrf-drivers (Python, ROS 2), ErdiLRF (Arduino)source 2026-11-12
ERDILRF600H905600 m0.05–600 m (90% reflectivity); 0.05–200 m (10% reflectivity) (The two source values remain bound to their stated target reflectivity.)0.05±10 cm (<10 m); 1% (≥10 m)1 kHz or 50 Hz (automatically switched to match reflected-signal intensity)UART/IIC20erdi-lrf-drivers (Python, ROS 2), ErdiLRF (Arduino)source 2026-11-12
GarminLIDAR-Lite v390540 m70% reflective target±2.5 cm (1 in.) typical (<5 m); ±10 cm (3.9 in.) typical (>=5 m)270 Hz typical; 650 Hz fast mode; >1000 Hz short range onlyI2C, PWM22LIDARLite_Arduino_Library (GitHub, Garmin, Apache-2.0), ArduPilot AP_RangeFindersource 2026-11-06
GarminLIDAR-Lite v3HP90540 m70% reflective target0.05±1 cm (0.4 in.) (<2 m); ±5 cm (2 in.) typical (>=2 m)Greater than 1 kHz typicalI2C, PWM38LIDARLite_Arduino_Library (GitHub, Garmin, Apache-2.0), ArduPilot AP_RangeFindersource 2026-11-17
GarminLIDAR-Lite v4 LED94010 m90% reflective target, indoors (range measured from back of unit); LED (not laser) light source0.05Repeatability (1 sigma, 90% target, high accuracy mode with averaging): ±1 cm to 2 m; ±2 cm to 4 m; ±5 cm to 10 mI2C >200 Hz typical; ANT up to 200 Hz (90% target indoors at 2 m)I2C or ANT (SPI configurable via Nordic SDK)14.6LIDARLite_Arduino_Library (GitHub, garmin), ArduPilot AP_RangeFindersource 2026-11-17
LightWareGRF-250905250 mat 50 Hz update rate, 40% albedo, 10 km visibility, 1.4 m x 1.4 m target size0.2± 50 cm (1 sigma)1 to 50 readings per secondUSB, Serial UART and I2C (3.3 V TTL, 5 V tolerant)10.7grf250-api (GitHub, LightWare, MIT), ArduPilot AP_RangeFindersource 2026-11-06
LightWareGRF-500905500 mat 5 Hz update rate, 40% albedo, 23 km visibility, 4 m x 4 m target size0.2± 50 cm (1 sigma)0.5 to 10 readings per secondUSB, Serial UART and I2C (3.3 V TTL, 5 V tolerant)10.7grf-500-api (GitHub, LightWare, MIT-0), ArduPilot AP_RangeFindersource 2026-11-06
LightWareLW20/C905100 m70% reflectivity0.248 to 5 000 readings per secondSerial UART and I2C (3.3 V TTL, 5 V tolerant)19.5LW20-Api (GitHub, LightWare-Optoelectronics), ArduPilot AP_RangeFindersource 2026-11-06
LightWareLW20/HA100 m70% reflectivity0.2Better than 1cm over 100m48 to 1 250 readings per secondSerial UART and I2C (3.3 V TTL, 5 V tolerant)19.5LW20-Api (GitHub, LightWare-Optoelectronics), ArduPilot AP_RangeFindersource 2026-11-17
LightWareSF000/B90550 m70% reflectivity0.248 to 388 readings per secondSerial UART and I2C (3.3 V TTL, 5 V tolerant)9.8source 2026-11-06
LightWareSF20/C905100 m70% reflectivity0.248 to 5 000 readings per secondUSB, Serial UART and I2C (3.3 V TTL, 5 V tolerant)7.5LW20-Api (GitHub, LightWare-Optoelectronics), ArduPilot AP_RangeFindersource 2026-11-06
LightWareSF20/HA100 m70% reflectivity0.2Better than 1cm over 100m48 to 1 250 readings per secondUSB, Serial UART and I2C (3.3 V TTL, 5 V tolerant)7.5LW20-Api (GitHub, LightWare-Optoelectronics), ArduPilot AP_RangeFindersource 2026-11-17
LightWareSF30/D905200 m70% reflectivity0.239 to 20 000 readings per secondUSB, Serial UART and I2C (3.3 V TTL, 5 V tolerant)30source 2026-11-06
NooploopTOFSense-F15 m0.05±6cm@[0.05,3)m; ±5%@[3,15]m350HzUART, IIC, I/O7.5Nooploop source download (TOFSense-F_Arduino_IIC_Driver_V1_1.zip), ArduPilot AP_RangeFindersource 2026-11-17
NooploopTOFSense-F P25 m0.053%@[0.05,25]m350HzUART, IIC, I/O7.5Nooploop source download (TOFSense-F_Arduino_IIC_Driver_V1_1.zip), ArduPilot AP_RangeFindersource 2026-11-17
NooploopTOFSense-F290525 m0.05±3.0cm100HzUART, IIC, I/O7.5ArduPilot AP_RangeFindersource 2026-11-17
NooploopTOFSense-F2 Mini9407.8 m0.02±4.0cm50HzUART, IIC, I/O1ArduPilot AP_RangeFindersource 2026-11-17
NooploopTOFSense-F2 P90550 m0.05±3.0cm100HzUART, IIC, I/O7.5ArduPilot AP_RangeFindersource 2026-11-17
NooploopTOFSense-F2 PH90550 m0.05±3.0cm100HzUART, IIC, I/Osource 2026-11-17
+ + diff --git a/docs/guides/index.html b/docs/guides/index.html index 4b2619a..708007d 100644 --- a/docs/guides/index.html +++ b/docs/guides/index.html @@ -17,7 +17,7 @@ th[data-k]{cursor:pointer}footer{margin-top:2em;font-size:.85em;color:var(--muted)}ul.cols{columns:2 22rem} -

Selection guides

Each guide is a filter over the dataset with the rule stated at the top. Data date 2026-11-17.

+

Selection guides

Each guide is a filter over the dataset with the rule stated at the top. Data date 2026-11-17.

diff --git a/docs/llms.txt b/docs/llms.txt index 41f865d..e16164e 100644 --- a/docs/llms.txt +++ b/docs/llms.txt @@ -30,6 +30,8 @@ Manufacturers: ERDI LASER (ERDI TECH LTD), JRT, Benewake, LightWare, DFRobot, Lu - [Terabee TeraRanger Evo 60m alternatives: 20 comparable laser rangefinder modules](https://erditech.com/laser-rangefinder-module-database/alternatives/teraranger-evo-60m/): Modules comparable to the Terabee TeraRanger Evo 60m (60 m, UART/I2C/USB): same range class, weight and interface, with manufacturer-sourced specs, prices and drivers. Data date 2026-11-17. - [Terabee TeraRanger Evo 15m alternatives: 21 comparable laser rangefinder modules](https://erditech.com/laser-rangefinder-module-database/alternatives/teraranger-evo-15m/): Modules comparable to the Terabee TeraRanger Evo 15m (15 m, UART/I2C/USB): same range class, weight and interface, with manufacturer-sourced specs, prices and drivers. Data date 2026-11-17. - [Alternatives to popular laser rangefinder and LiDAR modules](https://erditech.com/laser-rangefinder-module-database/alternatives/): Comparable modules for TFmini-S, TF-Luna, TF02-Pro, TF03, SF11/C, SF30/D, LW20/C, LIDAR-Lite v3HP, TeraRanger Evo and others, from an open manufacturer-sourced dataset. +- [Laser rangefinder modules with a published CAN interface](https://erditech.com/laser-rangefinder-module-database/guides/can-bus-rangefinder-modules/): 13 modules matching: category is rangefinder module, published interface includes CAN, published max range is present, and status is not discontinued; unknown status remains unknown. Manufacturer-sourced specs, prices and source links. +- [Laser rangefinder modules with a published I2C interface](https://erditech.com/laser-rangefinder-module-database/guides/i2c-rangefinder-modules/): 37 modules matching: category is rangefinder module, published interface includes I2C, IIC or I²C, published max range is present, and status is not discontinued; unknown status remains unknown. Manufacturer-sourced specs, prices and source links. - [Laser rangefinder modules for a 1 km drone altimeter](https://erditech.com/laser-rangefinder-module-database/guides/drone-altimeter-1km/): 49 modules matching: published max range ≥ 1,000 m, published weight ≤ 60 g, and a UART, I2C or CAN interface that a flight controller or companion computer can read. Manufacturer-sourced specs, prices and source links. - [Eye-safe 1535 / 1550 nm laser rangefinder modules](https://erditech.com/laser-rangefinder-module-database/guides/eye-safe-1535nm/): 63 modules matching: published wavelength 1400-1700 nm (in practice 1535 and 1550 nm Er:glass or fibre-laser based modules). Manufacturer-sourced specs, prices and source links. - [Long-range laser rangefinder modules (over 2 km)](https://erditech.com/laser-rangefinder-module-database/guides/long-range-over-2km/): 70 modules matching: published max range ≥ 2,000 m (any wavelength). Manufacturer-sourced specs, prices and source links. diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 0575a80..26e29da 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -17,6 +17,8 @@ https://erditech.com/laser-rangefinder-module-database/alternatives/teraranger-evo-60m/2026-11-17 https://erditech.com/laser-rangefinder-module-database/alternatives/teraranger-evo-15m/2026-11-17 https://erditech.com/laser-rangefinder-module-database/alternatives/2026-11-17 +https://erditech.com/laser-rangefinder-module-database/guides/can-bus-rangefinder-modules/2026-11-17 +https://erditech.com/laser-rangefinder-module-database/guides/i2c-rangefinder-modules/2026-11-17 https://erditech.com/laser-rangefinder-module-database/guides/drone-altimeter-1km/2026-11-17 https://erditech.com/laser-rangefinder-module-database/guides/eye-safe-1535nm/2026-11-17 https://erditech.com/laser-rangefinder-module-database/guides/long-range-over-2km/2026-11-17 diff --git a/scripts/build_views.py b/scripts/build_views.py index ab375a1..bf3cd03 100644 --- a/scripts/build_views.py +++ b/scripts/build_views.py @@ -184,7 +184,7 @@ def drv_html(r): ] -def table(rows, cols=None, self_row=None, extra=None, sortable=False): +def table(rows, cols=None, self_row=None, extra=None, sortable=False, full_conditions=False): cols = cols or [c[0] for c in COLS] spec = [c for c in COLS if c[0] in cols] th = "".join(f'{h}' if sortable else f"{h}" for k, h, _, _ in spec) @@ -199,7 +199,8 @@ def table(rows, cols=None, self_row=None, extra=None, sortable=False): f'data-drv="{1 if has_driver(r) else 0}" data-cat="{E(r["category"])}" ' f'data-status="{r["status"]}"') cls = ' class="self"' if r is self_row else "" - tds = "".join(f'{fn(r)}' for k, _, fn, num in spec) + tds = "".join(f'{E(cell(r["range_condition"])) if k == "cond" and full_conditions else fn(r)}' + for k, _, fn, num in spec) if extra: tds += f"{extra[1](r)}" out.append(f"{tds}") @@ -411,6 +412,35 @@ def under(v, lim): GUIDES = [ + {"slug": "can-bus-rangefinder-modules", "title": "Laser rangefinder modules with a published CAN interface", + "short": "CAN interface modules", + "rule": "category is rangefinder module, published interface includes CAN, published max range is present, " + "and status is not discontinued; unknown status remains unknown", + "filter": lambda r: r["category"] == "rangefinder module" and "CAN" in iface_tags(r) + and r["status"] != "discontinued", + "sort": lambda r: (short_brand(r["brand"]).lower(), r["model"]), + "cols": [c[0] for c in COLS if c[0] != "usd"], + "notes": ["CAN in the interface field is a shortlist criterion, not a claim that two modules share a " + "message format, connector or application protocol. Confirm the exact interface variant, bitrate, " + "pinout, termination and protocol document before integration.", + "Keep each range beside its manufacturer's target condition. The table is ordered by manufacturer " + "and model, not by an inferred performance ranking.", + "Empty fields retain the dataset's null meaning: no published value is recorded. Check the linked " + "source and capture date for availability and current specifications. Request price."]}, + {"slug": "i2c-rangefinder-modules", "title": "Laser rangefinder modules with a published I2C interface", + "short": "I2C interface modules", + "rule": "category is rangefinder module, published interface includes I2C, IIC or I²C, published max range " + "is present, and status is not discontinued; unknown status remains unknown", + "filter": lambda r: r["category"] == "rangefinder module" and "I2C" in iface_tags(r) + and r["status"] != "discontinued", + "sort": lambda r: (short_brand(r["brand"]).lower(), r["model"]), + "cols": [c[0] for c in COLS if c[0] != "usd"], + "notes": ["I2C labels do not establish plug compatibility. Confirm supply and logic voltage separately, " + "address selection, pull-up requirements, register map and the exact ordered interface variant.", + "The interface filter includes modules intended for different media and target conditions. " + "Read the range condition before comparing rows; an underwater specification is not an air rating.", + "A listed driver names a particular model; an empty driver field is not proof that no driver " + "exists. No electrical limits, range values or compatibility claims have been inferred. Request price."]}, {"slug": "drone-altimeter-1km", "title": "Laser rangefinder modules for a 1 km drone altimeter", "short": "drone altimeter, 1 km", "rule": "published max range ≥ 1,000 m, published weight ≤ 60 g, and a UART, I2C or CAN interface " @@ -490,7 +520,8 @@ def build_guides(): "manufacturer page the values were copied from.

") body = [nav(), f"

{E(g['title'])}

", lead, "

What to check

    " + "".join(f"
  • {E(n)}
  • " for n in g["notes"]) + "
", - f"

Matching modules ({len(rows)})

", table(rows)] + f"

Matching modules ({len(rows)})

", + table(rows, cols=g.get("cols"), full_conditions=bool(g.get("cols")))] if g.get("second"): t2, f2 = g["second"] rows2 = sorted([r for r in RANGE_ROWS if f2(r)], key=lambda r: (r["price_public_usd"], -r["max_range_m"])) diff --git a/tests/test_interface_guides.py b/tests/test_interface_guides.py new file mode 100644 index 0000000..f119e7f --- /dev/null +++ b/tests/test_interface_guides.py @@ -0,0 +1,27 @@ +import html +import json +from pathlib import Path + +import pytest + + +ROOT = Path(__file__).resolve().parents[1] + + +@pytest.mark.parametrize("slug,count", [ + ("can-bus-rangefinder-modules", 13), + ("i2c-rangefinder-modules", 37), +]) +def test_interface_guides_preserve_source_conditions_and_omit_prices(slug, count): + page = (ROOT / "docs" / "guides" / slug / "index.html").read_text() + assert f"Matching modules ({count})" in page + assert "USD (1 pc)" not in page + assert "Request price" in page + rows = json.loads((ROOT / "data" / "modules.json").read_text()) + for row in rows: + model = f'>{html.escape(row["model"])}<' + if model in page: + assert html.escape(row["range_condition"] or "") in page + assert html.escape(row["source_url"]) in page + assert row["status"] != "discontinued" + assert "not a claim" in page if slug.startswith("can-") else "not an air rating" in page