by adom
ST VL53L5CX Time-of-Flight 8x8 multizone ranging sensor, 400 cm, 63 deg diagonal FoV, I2C, optical LGA-16 6.4 x 3.0 x 1.5 mm. Pinout extracted from the datasheet, KiCad symbol with chip outline, footprint, Fusion library, manufacturer STEP (Z-up, FoV on/off, side-etched MPN) and provenance.
main
John Lauer
Family contract: pipeline 1.0.0 that built the three VL53Lx pages
8e4500f
#!/bin/bash
# Create (once) and push the three component pages from wiki/<slug>/ in size-bounded batches.
set -u
cd "$(dirname "$0")/../wiki" || exit 1
MAXB=$((3500*1024))
declare -A MPN=( [vl53l5cx]="VL53L5CXV0GC/1" [vl53l7cx]="VL53L7CXV0GC/1" [vl53l8cx]="VL53L8CXV0GC/1" )
declare -A TITLE=( [vl53l5cx]="VL53L5CX" [vl53l7cx]="VL53L7CX" [vl53l8cx]="VL53L8CX" )
declare -A SUB=( [vl53l5cx]="8x8 multizone ToF sensor, 400 cm, 63 deg FoV, I2C: symbol, footprint, Fusion .lbr, manufacturer STEP with FoV on/off and side-etched MPN, datasheet, provenance" \
[vl53l7cx]="8x8 multizone ToF sensor with a 90 deg FoV, 350 cm, I2C, VL53L5CX pin-compatible: symbol, footprint, Fusion .lbr, manufacturer STEP with FoV on/off and side-etched MPN, datasheet, provenance" \
[vl53l8cx]="Low-power 8x8 multizone ToF sensor, 400 cm, 65 deg FoV, I2C or SPI, 1.8 V core: symbol, footprint, Fusion .lbr, manufacturer STEP with FoV on/off and side-etched MPN, datasheet, provenance" )
for slug in "${@:-vl53l5cx vl53l7cx vl53l8cx}"; do
cd "$slug" || continue
brief=$(python3 -c "import json; print(json.load(open('page.json'))['brief'])")
url=$(python3 -c "import json; print(json.load(open('page.json'))['component']['product_page'])")
if ! timeout 60 adom-wiki repo show adom/$slug page.json >/dev/null 2>&1; then
echo "== creating adom/$slug (pages API: the CLI create has no distributor flag)"
python3 - "$slug" "${TITLE[$slug]}" "${SUB[$slug]}" > /tmp/create-body-$slug.json <<'PY'
import json,sys
slug,title,sub=sys.argv[1:4]; pg=json.load(open("page.json"))
body={"slug":slug,"org":"adom","type":"hardware","kind":"component","title":title,"brief":pg["brief"],"version":"0.1.0",
"because":"No wiki page exists for this exact STMicroelectronics part number; the three VL53Lx ToF pages hold the reviewed symbol, footprint, Fusion library, manufacturer STEP variants and provenance that every Adom user reproducing the ToF sensor library needs, so they must not live only in one project folder.",
"hero":{"headline":title,"subhead":sub,"screenshot":"docs/hero.png","chrome":False},
"source":{"tool":"cse","url":pg["component"]["product_page"]},
"component":pg["component"],"tags":pg["tags"],"discovery_triggers":pg["discovery_triggers"],"discovery_pitch":pg["discovery_pitch"],"license":"CC-BY-4.0","visibility":{"public":True}}
print(json.dumps(body))
PY
timeout 120 adom-wiki api -X POST /api/v1/pages --body "$(cat /tmp/create-body-$slug.json)" --json 2>&1 | python3 -c "import sys,json; d=json.load(sys.stdin); p=(d.get('data') or {}).get('page') or {}; print('create:', d.get('status'), p.get('id'), p.get('slug'), str(d.get('data'))[:200] if d.get('status')!='ok' else '')"
fi
echo "== pushing adom/$slug"
# batches by size; page.json goes LAST so the hero/title stay linked
mapfile -t files < <(find . -type f ! -name page.json -printf '%s %p\n' | sort -k2 | sed 's#^\([0-9]*\) \./#\1 #')
batch=(); size=0; n=0
flush(){ [ ${#batch[@]} -eq 0 ] && return; n=$((n+1)); timeout 600 adom-wiki repo push adom/$slug --files "${batch[@]}" -m "ToF component page: batch $n (${#batch[@]} files)" 2>&1 | grep -iE '"commit"|error|413|too large' | head -2; batch=(); size=0; }
for line in "${files[@]}"; do s=${line%% *}; f=${line#* }; if [ $((size+s)) -gt $MAXB ] && [ ${#batch[@]} -gt 0 ]; then flush; fi; batch+=("$f"); size=$((size+s)); done; flush
timeout 300 adom-wiki repo push adom/$slug --files page.json -m "ToF component page: page.json (component block, hero, files)" 2>&1 | grep -iE '"commit"|error' | head -2
cd ..
done