← Back to Pull requests

zephyr: drivers: adc: adc_emul_generator: Wrap generated values when reaching channel resolution #1607

Open
unknown opened this pull request with 172 lines diff across 2 files
View on GitHub
unknown unknown commented on Oct 20, 2026 09:35 UTC
Author

The generator incremented each channel's raw value without bound, so after enough samples it reached values which could no longer fit the channel's configured resolution. In testing, this might seem like an issue with iiod or the libiio client app, such as Scopy, as the value exposed by the emulated ADC is expected to be continuously changing, but it actually remains constant (see image below).

<img width="2560" height="1364" alt="Screenshot 2026-10-20 122406" src="https://github.com/user-attachments/assets/a983df31-18d4-4b9e-be01-99940568a380" />

Added wrapping mechanism so the samples continuously cycle through the channel's entire range.

<img width="2557" height="1369" alt="Screenshot 2026-10-20 122138" src="https://github.com/user-attachments/assets/787cd51f-01b6-4f53-bf78-2e55d41e61ef" />

PR Type


  • Bug fix (a change that fixes an issue)

  • New feature (a change that adds new functionality)

  • Breaking change (a change that affects other repos or cause CIs to fail)
  • PR Checklist


  • I have conducted a self-review of my own code changes

  • I have commented new code, particularly complex or unclear areas

  • I have checked that I did not introduce new warnings or errors (CI output)

  • I have checked that components that use libiio did not get broken

  • I have updated the documentation accordingly (GitHub Pages, READMEs, etc)
  • Diff: 172 lines (+129 / -43) across 2 files Reviewer: MaureenHelm Review duration: 8917m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.35 · 172 lines diff across 2 files
    0.35
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.308
    Real PR Conversation Timeline
    1 comments
    "Review active on #1607"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 35.3% (MEDIUM) · Higher = larger blast radius
    35.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.8% · Safe to merge
    18.8%