Skip to content

Commit

Permalink
add anti-glare mode to GC0328 camera
Browse files Browse the repository at this point in the history
  • Loading branch information
odudex committed Dec 16, 2024
1 parent 923ccac commit 0a9a88a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/krux/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ class Camera:
ENTROPY_MODE: (0x20, 0xF2),
BINARY_GRID_MODE: (0x30, 0x50),
},
GC0328_ID: {
QR_SCAN_MODE: 0x70,
ANTI_GLARE_MODE: 0x40,
ENTROPY_MODE: 0x80,
BINARY_GRID_MODE: 0x70,
},
}

def __init__(self):
Expand Down Expand Up @@ -146,11 +152,19 @@ def config_gc_2145(self):

def has_antiglare(self):
"""Returns whether the camera has anti-glare functionality"""
return self.cam_id in (OV7740_ID, OV2640_ID, GC2145_ID)
return self.cam_id in (OV7740_ID, OV2640_ID, GC2145_ID, GC0328_ID)

def luminosity_threshold(self):
"""Set luminosity thresholds for cameras"""

if self.cam_id == GC0328_ID:
target = self.lum_th.get(self.cam_id, {}).get(self.mode, 0x80)
# Set register bank 1
sensor.__write_reg(0xFE, 0x01)
# Expected luminance level, default=0x50
sensor.__write_reg(0x13, target)
return

(low, high) = self.lum_th.get(self.cam_id, {}).get(self.mode, (0, 0))
if low < 0x10 or high > 0xF0:
return
Expand Down

0 comments on commit 0a9a88a

Please sign in to comment.