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: fix passing unsigned integers to component #3672

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion internal/conf/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func loadEnvInternal(env map[string]string, prefix string, prv reflect.Value) er
}
return nil

case reflect.TypeOf(uint64(0)):
case reflect.TypeOf(uint(0)):
if ev, ok := env[prefix]; ok {
if prv.IsNil() {
prv.Set(reflect.New(rt))
Expand Down
8 changes: 4 additions & 4 deletions internal/conf/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func intPtr(v int) *int {
return &v
}

func uint64Ptr(v uint64) *uint64 {
func uintPtr(v uint) *uint {
return &v
}

Expand Down Expand Up @@ -75,8 +75,8 @@ type testStruct struct {
MyStringOpt *string `json:"myStringOpt"`
MyInt int `json:"myInt"`
MyIntOpt *int `json:"myIntOpt"`
MyUint uint64 `json:"myUint"`
MyUintOpt *uint64 `json:"myUintOpt"`
MyUint uint `json:"myUint"`
MyUintOpt *uint `json:"myUintOpt"`
MyFloat float64 `json:"myFloat"`
MyFloatOpt *float64 `json:"myFloatOpt"`
MyBool bool `json:"myBool"`
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestLoad(t *testing.T) {
MyInt: 123,
MyIntOpt: intPtr(456),
MyUint: 8910,
MyUintOpt: uint64Ptr(112313),
MyUintOpt: uintPtr(112313),
MyFloat: 15.2,
MyFloatOpt: float64Ptr(16.2),
MyBool: true,
Expand Down
14 changes: 7 additions & 7 deletions internal/conf/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ type Path struct {
SourceRedirect string `json:"sourceRedirect"`

// Raspberry Pi Camera source
RPICameraCamID int `json:"rpiCameraCamID"`
RPICameraWidth int `json:"rpiCameraWidth"`
RPICameraHeight int `json:"rpiCameraHeight"`
RPICameraCamID uint `json:"rpiCameraCamID"`
RPICameraWidth uint `json:"rpiCameraWidth"`
RPICameraHeight uint `json:"rpiCameraHeight"`
RPICameraHFlip bool `json:"rpiCameraHFlip"`
RPICameraVFlip bool `json:"rpiCameraVFlip"`
RPICameraBrightness float64 `json:"rpiCameraBrightness"`
Expand All @@ -143,7 +143,7 @@ type Path struct {
RPICameraAWB string `json:"rpiCameraAWB"`
RPICameraAWBGains []float64 `json:"rpiCameraAWBGains"`
RPICameraDenoise string `json:"rpiCameraDenoise"`
RPICameraShutter int `json:"rpiCameraShutter"`
RPICameraShutter uint `json:"rpiCameraShutter"`
RPICameraMetering string `json:"rpiCameraMetering"`
RPICameraGain float64 `json:"rpiCameraGain"`
RPICameraEV float64 `json:"rpiCameraEV"`
Expand All @@ -157,12 +157,12 @@ type Path struct {
RPICameraAfSpeed string `json:"rpiCameraAfSpeed"`
RPICameraLensPosition float64 `json:"rpiCameraLensPosition"`
RPICameraAfWindow string `json:"rpiCameraAfWindow"`
RPICameraFlickerPeriod int `json:"rpiCameraFlickerPeriod"`
RPICameraFlickerPeriod uint `json:"rpiCameraFlickerPeriod"`
RPICameraTextOverlayEnable bool `json:"rpiCameraTextOverlayEnable"`
RPICameraTextOverlay string `json:"rpiCameraTextOverlay"`
RPICameraCodec string `json:"rpiCameraCodec"`
RPICameraIDRPeriod int `json:"rpiCameraIDRPeriod"`
RPICameraBitrate int `json:"rpiCameraBitrate"`
RPICameraIDRPeriod uint `json:"rpiCameraIDRPeriod"`
RPICameraBitrate uint `json:"rpiCameraBitrate"`
RPICameraProfile string `json:"rpiCameraProfile"`
RPICameraLevel string `json:"rpiCameraLevel"`

Expand Down
14 changes: 7 additions & 7 deletions internal/staticsources/rpicamera/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package rpicamera

type params struct {
LogLevel string
CameraID int
Width int
Height int
CameraID uint
Width uint
Height uint
HFlip bool
VFlip bool
Brightness float64
Expand All @@ -16,7 +16,7 @@ type params struct {
AWBGainRed float64
AWBGainBlue float64
Denoise string
Shutter int
Shutter uint
Metering string
Gain float64
EV float64
Expand All @@ -30,12 +30,12 @@ type params struct {
AfSpeed string
LensPosition float64
AfWindow string
FlickerPeriod int
FlickerPeriod uint
TextOverlayEnable bool
TextOverlay string
Codec string
IDRPeriod int
Bitrate int
IDRPeriod uint
Bitrate uint
Profile string
Level string
}
4 changes: 2 additions & 2 deletions internal/staticsources/rpicamera/params_serialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func (p params) serialize() []byte {
f := rv.Field(i)

switch f.Kind() {
case reflect.Int:
entry += strconv.FormatInt(f.Int(), 10)
case reflect.Uint:
entry += strconv.FormatUint(f.Uint(), 10)

case reflect.Float64:
entry += strconv.FormatFloat(f.Float(), 'f', -1, 64)
Expand Down
Loading