Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpi camera: add additional checks on configuration #2368

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions internal/conf/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,48 @@
}
}

switch pconf.RPICameraExposure {
case "normal", "short", "long", "custom":
default:
return fmt.Errorf("invalid 'rpiCameraExposure' value")

Check warning on line 262 in internal/conf/path.go

View check run for this annotation

Codecov / codecov/patch

internal/conf/path.go#L259-L262

Added lines #L259 - L262 were not covered by tests
}

switch pconf.RPICameraAWB {
case "auto", "incandescent", "tungsten", "fluorescent", "indoor", "daylight", "cloudy", "custom":
default:
return fmt.Errorf("invalid 'rpiCameraAWB' value")

Check warning on line 268 in internal/conf/path.go

View check run for this annotation

Codecov / codecov/patch

internal/conf/path.go#L265-L268

Added lines #L265 - L268 were not covered by tests
}

switch pconf.RPICameraDenoise {
case "off", "cdn_off", "cdn_fast", "cdn_hq":
default:
return fmt.Errorf("invalid 'rpiCameraDenoise' value")

Check warning on line 274 in internal/conf/path.go

View check run for this annotation

Codecov / codecov/patch

internal/conf/path.go#L271-L274

Added lines #L271 - L274 were not covered by tests
}

switch pconf.RPICameraMetering {
case "centre", "spot", "matrix", "custom":
default:
return fmt.Errorf("invalid 'rpiCameraMetering' value")

Check warning on line 280 in internal/conf/path.go

View check run for this annotation

Codecov / codecov/patch

internal/conf/path.go#L277-L280

Added lines #L277 - L280 were not covered by tests
}

switch pconf.RPICameraAfMode {
case "auto", "manual", "continuous":
default:
return fmt.Errorf("invalid 'rpiCameraAfMode' value")

Check warning on line 286 in internal/conf/path.go

View check run for this annotation

Codecov / codecov/patch

internal/conf/path.go#L283-L286

Added lines #L283 - L286 were not covered by tests
}

switch pconf.RPICameraAfRange {
case "normal", "macro", "full":
default:
return fmt.Errorf("invalid 'rpiCameraAfRange' value")

Check warning on line 292 in internal/conf/path.go

View check run for this annotation

Codecov / codecov/patch

internal/conf/path.go#L289-L292

Added lines #L289 - L292 were not covered by tests
}

switch pconf.RPICameraAfSpeed {
case "normal", "fast":
default:
return fmt.Errorf("invalid 'rpiCameraAfSpeed' value")

Check warning on line 298 in internal/conf/path.go

View check run for this annotation

Codecov / codecov/patch

internal/conf/path.go#L295-L298

Added lines #L295 - L298 were not covered by tests
}

default:
return fmt.Errorf("invalid source: '%s'", pconf.Source)
}
Expand Down
Loading