OpenIPC / firmware

Alternative IP Camera firmware from an open community
https://openipc.org
MIT License
1.21k stars 232 forks source link

Majestic Night/Day: GPIO Hi/Low inverted ("IRcut filter polarity is inverted" defective) #1306

Closed LukeO1982 closed 7 months ago

LukeO1982 commented 7 months ago

Dear community,

configuring automatic night/day change with IRCUT and IRLED is impossible because: DAY mode pulls GPIO 3 (IRCUT) to HI = retracts the IR filter NIGHT mode clears GPIO 3 (IRCUT) to LOW = engages the IR filter) This is exactly the wrong behavior for my device.

Option "IRcut filter polarity is inverted" does not seem to do anything. I have searched the "firmware" source code on github to determine the function where this is executed, but failed.

Please explain where this behavior is implemented so I can help fixing / enhancing the function.

Hardware: FOSCAM C2M v6 sensor='gc2053' sensor_ini='gc2053_i2c' soc='ssc337de' soc_family='infinity6b0'

Running fw_build='master+a224d85, 2024-02-08' fw_variant='lite' fw_version='2.4.02.08' Majestic Lite for SigmaStar, version master+0b86ebc, built on 2024-02-08

Regards Lukas

jimsmt commented 7 months ago

Please run majestic in foreground, toggle the button, check majestic's log

LukeO1982 commented 7 months ago

Here you go: Details: goip 3 is the IRCUT, gpio 0 is the IR LED IRCUT polarity is inverted here.

This is the automatic switch to night right after start: 20:00:03 < majestic> [ night] setup_gpio_listener@201 Starting monitor for light sensor 20:00:03 < majestic> [ night] set_night_mode@116 Change mode to NIGHT 20:00:03 < majestic> [ gpio] set_gpio@25 set_gpio(3, 0) 20:00:03 < majestic> [ gpio] set_gpio@25 set_gpio(0, 1)

And a change to day mode: 20:00:50 < majestic> [ night] set_night_mode@116 Change mode to DAY 20:00:50 < majestic> [ gpio] set_gpio@25 set_gpio(3, 1) 20:00:50 < majestic> [ gpio] set_gpio@25 set_gpio(0, 0)

Now: Disable IRCUT polarity invert, but the behavior is the same 20:03:40 < majestic> [ night] set_night_mode@116 Change mode to NIGHT 20:03:40 < majestic> [ gpio] set_gpio@25 set_gpio(3, 0) 20:03:40 < majestic> [ gpio] set_gpio@25 set_gpio(0, 1) 20:03:59 < majestic> [ night] set_night_mode@116 Change mode to DAY 20:03:59 < majestic> [ gpio] set_gpio@25 set_gpio(3, 1) 20:03:59 < majestic> [ gpio] set_gpio@25 set_gpio(0, 0)

jimsmt commented 7 months ago

Please update to newest build and test again

LukeO1982 commented 7 months ago

No update is available, I have updated to latest before my test and log output: Installed 2.4.02.09 On GitHub 2.4.02.09

Can you provide details on what was changed and where?

jimsmt commented 7 months ago

what's the majestic version? majestic -v https://t.me/openipc_log/4

LukeO1982 commented 7 months ago

Both majestic -v master+f9af286, 2024-02-09 and System OVerview agree: Firmware

Version 2.4.02.09-lite Build master+889fa23, 2024-02-09 Majestic master+f9af286, 2024-02-09 U-Boot U-Boot 2015.01 (Dec 20 2023 - 06:26:48)

jimsmt commented 7 months ago

I just tested it on a SSC337 lite camera, it works as expected

LukeO1982 commented 7 months ago

Thanks, so I need "not inverted", therefore this is my config:

.nightMode.enabled: true .nightMode.irSensorPin: 80 .nightMode.irSensorPinInvert: false .nightMode.irCutPin1: 3 .nightMode.irCutPin2: .nightMode.irCutSingleInvert: false .nightMode.dncDelay: .nightMode.backlightPin: 0 .nightMode.colorToGray: true .nightMode.drcOverride: .nightMode.minThreshold: .nightMode.maxThreshold:

I confirm correct behavior. However I am confused why I could not manage to get this working prior, although systematically changing the config. I remember hearing 2 clicks of the IR Filter previously when changing options. Thanks, I am marking this closes and solved.