Skip to content

ak3918ev300_lite_heimvision-pe3020w: IR-cut 42 night / 41 day, light monitor on - #266

Merged
openipc-ai merged 2 commits into
masterfrom
pe3020w-ircut-direction
Nov 21, 2026
Merged

openipc-ai merged 2 commits into
masterfrom
pe3020w-ircut-direction

Conversation

@openipc-ai

@openipc-ai openipc-ai commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Confirmed on the physical PE3020-W in #234 (comment). With irCutPin1=42 and irCutPin2=41:

Action Driven output High time
Assign the pins in one config POST GPIO41 (day) 157.7 ms
Cover the photocell, light monitoring on GPIO42 (night) 152.6 ms
Uncover it GPIO41 (day) 150.4 ms

Both pads were back low after every pulse. Majestic counted one automatic transition each way, and the photocell read 2999 → 36–41 → 2999 mV.

Changes

The ADC reading depends on OpenIPC/linux#281, the EV300 SAR-ADC1 fix; a kernel without it reads 0 mV, which with lightMonitor on would hold the camera at night. #281 is merged into anyka-ak3918ev300, so every image built from here carries it. The test image for #234 checks this.

…monitor on

Confirmed on the camera (#234): with irCutPin1=42 and irCutPin2=41 the
filter swings to night when the photocell is covered and back to day when
it is uncovered, each pulse 150-158 ms, both pads back low. Majestic
counted one automatic transition each way.

The pins are swapped from the guessed 41/42, and nightMode.lightMonitor
is turned on now that the direction is known.
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Correct PE3020-W IR-cut direction and enable automatic day/night switching

🐞 Bug fix ✨ Enhancement 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Assign GPIO 42 to night and GPIO 41 to day, matching observed IR-cut movement.
• Enable photocell-driven day/night switching now that the filter direction is confirmed.
• Update the device status to reflect streaming and the verified IR-cut and photocell behavior.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed configuration is device-specific and controls one end-to-end camera behavior: photocell-based mode selection followed by IR-cut actuation affecting the video image.
  • The GPIO assignments, ADC settings, and automatic monitor are connected steps of that same bounded camera capability, not independent capabilities or deployment layers.
  • The path is supported by the customizer's direct nightMode writes and its first-boot runtime role.
Sources

devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[17-22]

# IR-cut: Majestic pulses irCutPin1 for night and irCutPin2 for day. On this
# board GPIO 42 swings the filter to night and GPIO 41 back to day, each pulse
# about 150 ms and driven back low (confirmed on the camera,
# OpenIPC/builder#234).
cli -s .nightMode.irCutPin1 42
cli -s .nightMode.irCutPin2 41

devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[25-31]

# Day and night from the photocell on SAR-ADC1 AIN0, in mV: about 3000 in
# light, under 50 covered (OpenIPC/builder#234), so high is light. Night
# below 300, day again above 1500, switched automatically.
cli -s .nightMode.lightMonitor true
cli -s .nightMode.adcReadout true
cli -s .nightMode.adcInvert true
cli -s .nightMode.adcChannel 0
Behavioral complexity 🟡 Medium 🧩 Interacting branches

  • Before: the script left automatic light monitoring disabled while documenting that the IR-cut direction was unconfirmed; day/night transitions therefore did not require the new automatic sensor-to-actuator interaction.
  • After: the script enables light monitoring, ADC inversion, channel selection, and asymmetric thresholds while assigning separate GPIOs for night and day.
  • New correctness condition: ADC readings must be interpreted with the configured polarity and hysteresis-like thresholds, and each resulting state transition must drive the corresponding IR-cut GPIO in the correct direction.
  • This is an interaction between sensor state, threshold transitions, and actuator direction, not complexity inherited merely from using the existing cli configuration mechanism.
  • The direct GPIO value edits themselves are straightforward; the material complexity comes from enabling the stateful automatic behavior.
Sources

devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[17-22]

# IR-cut: Majestic pulses irCutPin1 for night and irCutPin2 for day. On this
# board GPIO 42 swings the filter to night and GPIO 41 back to day, each pulse
# about 150 ms and driven back low (confirmed on the camera,
# OpenIPC/builder#234).
cli -s .nightMode.irCutPin1 42
cli -s .nightMode.irCutPin2 41

devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[25-31]

# Day and night from the photocell on SAR-ADC1 AIN0, in mV: about 3000 in
# light, under 50 covered (OpenIPC/builder#234), so high is light. Night
# below 300, day again above 1500, switched automatically.
cli -s .nightMode.lightMonitor true
cli -s .nightMode.adcReadout true
cli -s .nightMode.adcInvert true
cli -s .nightMode.adcChannel 0
Potential damage 🟡 Medium 🩹 Recoverable

  • The affected capability is camera imaging quality and automatic day/night operation.
  • A wrong IR-cut direction or automatic transition can produce degraded color, infrared, or exposure behavior, but the evidence does not indicate data corruption, confidentiality loss, financial effects, or an irreversible external action.
  • Reverting the source alone may not repair already-installed cameras because customizer.sh runs on first boot and writes runtime configuration; supported recovery would require rerunning the corrected cli settings, resetting the relevant configuration, or reinstalling/reinitializing the device.
  • Any physically moved filter can be returned by a subsequent correct actuation.
  • Recoverable through corrected runtime configuration and, if necessary, manual reapplication of the cli settings or device reinitialization.
  • Code rollback alone is insufficient for cameras that have already completed first-boot customization; no automatic repair worker or retry path is established in this repository.
Sources

devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[17-22]

# IR-cut: Majestic pulses irCutPin1 for night and irCutPin2 for day. On this
# board GPIO 42 swings the filter to night and GPIO 41 back to day, each pulse
# about 150 ms and driven back low (confirmed on the camera,
# OpenIPC/builder#234).
cli -s .nightMode.irCutPin1 42
cli -s .nightMode.irCutPin2 41

devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[25-31]

# Day and night from the photocell on SAR-ADC1 AIN0, in mV: about 3000 in
# light, under 50 covered (OpenIPC/builder#234), so high is light. Night
# below 300, day again above 1500, switched automatically.
cli -s .nightMode.lightMonitor true
cli -s .nightMode.adcReadout true
cli -s .nightMode.adcInvert true
cli -s .nightMode.adcChannel 0

CLAUDE.md[65-65]

- **`customizer.sh`** — runs on first boot. Applies device-specific runtime config:
Assessed commit bed8923
Diagram

graph TD
  Photo["Photocell AIN0"] --> ADC["ADC thresholds"] --> Monitor["Majestic light monitor"] --> Pins["GPIO 42 / 41"] --> Filter["IR-cut filter"]
  Config["Device customizer"] --> Monitor
Loading
High-Level Assessment

Keep the correction in the PE3020-W device customizer: the GPIO mapping was verified on this camera, and the existing Majestic light monitor already supports automatic switching. A global pin change or separate control mechanism would add scope without addressing a broader need.

Files changed (2) +9 / -9

Bug fix (1) +8 / -8
customizer.shCorrect IR-cut pins and enable photocell monitoring +8/-8

Correct IR-cut pins and enable photocell monitoring

• Assigns irCutPin1 to GPIO 42 for night and irCutPin2 to GPIO 41 for day, then enables automatic light monitoring. Updates comments to reflect the camera-verified pulse behavior; existing ADC settings remain unchanged.

devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh

Documentation (1) +1 / -1
README.mdRecord verified PE3020-W capabilities +1/-1

Record verified PE3020-W capabilities

• Updates the device row to report streaming, the GPIO directions for IR-cut, and the AIN0 photocell used for day/night detection.

README.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (1) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Default config enables auto day/night on an unfixed ADC 📎 Requirement gap ≡ Correctness
Description
customizer.sh now sets nightMode.lightMonitor true and keeps adcReadout true, so every first
boot of this profile switches the IR-cut from the photocell. The PR description says the ADC reads
valid values only with OpenIPC/linux#281, and that the released kernel reads 0 mV. On that kernel, a
reading of 0 mV is below the 300 mV night threshold, so the camera would be held in night mode. The
profile is presented as working on the strength of a single bench test with a patched kernel, which
the rule does not allow.
Code

devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[R27-28]

+# below 300, day again above 1500, switched automatically.
+cli -s .nightMode.lightMonitor true
Evidence
The added line enables automatic switching by default. The PR description states the ADC reading
depends on an unmerged kernel fix (OpenIPC/linux#281) and that the released kernel reads 0 mV. The
ADC keys (adcReadout true) are unchanged in the same file.

Verify native F37 capture before claiming video support
devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[25-30]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The customizer enables `nightMode.lightMonitor` by default. The photocell ADC only reads valid mV values with OpenIPC/linux#281, which is not in the released kernel (it reads 0 mV). On that kernel, every reading is below the night threshold, so the camera would stay in night mode after first boot.
## Fix Focus Areas
- devices/ak3918ev300_lite_heimvision-pe3020w/general/overlay/usr/share/openipc/customizer.sh[25-30]
## Recommended Fix
Remove or comment out `cli -s .nightMode.lightMonitor true` until the kernel fix is in the release image. Keep the comment that says the switching is pending the kernel fix, and state the dependency on OpenIPC/linux#281 in that comment. Re-enable the line in a follow-up once the released kernel reads valid mV.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. README marks streaming as working without a test ✓ Resolved
Description
The README row changes the PE3020-W status from majestic streaming not yet hardware-tested to a
bare streaming, which reads as a verified capability. The PR evidence covers only IR-cut pulses
and photocell readings, and no streaming test is listed. The caveat was removed without any test
that supports the new claim.

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@openipc-ai
openipc-ai merged commit 13118e3 into master Nov 21, 2026
7 checks passed
@openipc-ai
openipc-ai deleted the pe3020w-ircut-direction branch November 21, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant