|
| 1 | +driver: vl53l1x |
| 2 | +driver_class: VL53L1X |
| 3 | +i2c_address: 0x29 |
| 4 | + |
| 5 | +# I2C config for hardware tests (STeaMi board - STM32WB55) |
| 6 | +i2c: |
| 7 | + id: 1 |
| 8 | + |
| 9 | +# Register values for mock tests |
| 10 | +# VL53L1X uses 16-bit register addresses |
| 11 | +mock_registers: |
| 12 | + # MODEL_ID (0x010F-0x0110): expected 0xEACC |
| 13 | + 0x010F: [0xEA, 0xCC] |
| 14 | + # SOFT_RESET (0x0000): sensor active |
| 15 | + 0x0000: 0x01 |
| 16 | + # MM_CONFIG__OUTER_OFFSET_MM (0x0022): used during init |
| 17 | + 0x0022: [0x00, 0x00] |
| 18 | + # RESULT__RANGE_STATUS (0x0089): 17-byte result block |
| 19 | + # Bytes: range_status, report_status, stream_count, |
| 20 | + # dss_spads(2), peak_rate(2), ambient_rate(2), |
| 21 | + # sigma(2), phase(2), distance_mm(2), peak_corrected(2) |
| 22 | + # Simulated distance: 250 mm (0x00FA) |
| 23 | + 0x0089: [0x09, 0x00, 0x01, |
| 24 | + 0x00, 0x80, 0x01, 0x00, |
| 25 | + 0x00, 0x10, 0x00, 0x20, |
| 26 | + 0x00, 0x00, 0x00, 0xFA, |
| 27 | + 0x01, 0x00] |
| 28 | + |
| 29 | +tests: |
| 30 | + - name: "Verify model ID register" |
| 31 | + action: call |
| 32 | + method: read_model_id |
| 33 | + expect: 0xEACC |
| 34 | + mode: [mock, hardware] |
| 35 | + |
| 36 | + - name: "Read distance returns integer" |
| 37 | + action: call |
| 38 | + method: read |
| 39 | + expect_not_none: true |
| 40 | + mode: [mock] |
| 41 | + |
| 42 | + - name: "Distance in plausible range" |
| 43 | + action: call |
| 44 | + method: read |
| 45 | + expect_range: [0, 4000] |
| 46 | + mode: [hardware] |
| 47 | + |
| 48 | + - name: "Distance measurement feels correct" |
| 49 | + action: manual |
| 50 | + display: |
| 51 | + - method: read |
| 52 | + label: "Distance" |
| 53 | + unit: "mm" |
| 54 | + prompt: "La distance mesurée est-elle cohérente (objet devant le capteur) ?" |
| 55 | + expect_true: true |
| 56 | + mode: [hardware] |
0 commit comments