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

Pychronos dies upon trying to set specific resolution. #15

Open
DDR0 opened this issue Jun 14, 2019 · 1 comment
Open

Pychronos dies upon trying to set specific resolution. #15

DDR0 opened this issue Jun 14, 2019 · 1 comment
Assignees
Labels
defect API don't work. It says it should, but it doesn't. This is a clear and present bug.

Comments

@DDR0
Copy link
Contributor

DDR0 commented Jun 14, 2019

The following call crashes Pychcronos. It should result in an error message.

api2.control.call('set', {
	'resolution': {
		'hRes': 1280,
		'vRes': 1024,
		'hOffset': 0,
		'vOffset': 0,
		'minFrameTime': 1960780,
	},
	'framePeriod': 1960780,
})

Log:

2019-06-14 22:31:56,682 DEBUG [set] Setting resolution -> dbus.Dictionary({dbus.String('vRes'): dbus.Int32(1024, variant_level=1), dbus.String('minFrameTime'): dbus.Double(1960780.0, variant_level=1), dbus.String('hRes'): dbus.Int32(1280, variant_level=1), dbus.String('hOffset'): dbus.Int32(0, variant_level=1), dbus.String('vOffset'): dbus.Int32(0, variant_level=1)}, signature=dbus.Signature('sv'), variant_level=1)
2019-06-14 22:31:56,683 DEBUG [programInterm] programInterm - flip
2019-06-14 22:31:56,685 DEBUG [decompile] ----- wait(90000)
2019-06-14 22:31:56,693 DEBUG [decompile] frameClocks=90000 intClocks=90000
2019-06-14 22:31:56,713 DEBUG [updateWavetable] Selecting WT80 for 1280x1024
2019-06-14 22:31:56,743 DEBUG [programStandard] ProgramStandard: 176470200000000, 167646690000000
2019-06-14 22:31:56,745 DEBUG [programStandard] programStandard - flip
2019-06-14 22:31:56,747 DEBUG [set] Setting resolution failed: Register value out of range
2019-06-14 22:31:56,772 DEBUG [set] Traceback (most recent call last):
  File "cam-control.py", line 278, in set
    setattr(self.camera, name, value)
  File "/root/pychronos/pychronos/camera.py", line 1230, in resolution
    self.sensor.setResolution(geometry)
  File "/root/pychronos/pychronos/sensors/lux1310.py", line 377, in setResolution
    self.timing.programStandard(self.frameClocks, self.exposureClocks)
  File "/root/pychronos/pychronos/sensors/lux1310timing.py", line 184, in programStandard
    self.runProgram(prog, timeout)
  File "/root/pychronos/pychronos/regmaps/timing.py", line 165, in runProgram
    self.program[pc] = prog[pc]
ValueError: Register value out of range

2019-06-14 22:31:56,780 DEBUG [set] Setting framePeriod -> 1960780.0
2019-06-14 22:31:56,782 ERROR [programStandard] frameTime (176471) must be longer than integrationTime (167646690000000)
2019-06-14 22:31:56,783 DEBUG [programStandard] ProgramStandard: 176471, 167647
2019-06-14 22:31:56,785 DEBUG [programStandard] programStandard - flip
Python exited with code 139.
@DDR0 DDR0 added the defect API don't work. It says it should, but it doesn't. This is a clear and present bug. label Jun 14, 2019
@oskirby
Copy link
Contributor

oskirby commented Jun 26, 2019

First off, there is an error in the API call made here in that minFrameTime should be in units of seconds while framePeriod is in units of nanoseconds. This means that the initial frame time being set is off by an order of a billion, leading to an overflow in the timing program.

However, this should result in an exception being raised rather than a crash of the control daemon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect API don't work. It says it should, but it doesn't. This is a clear and present bug.
Projects
None yet
Development

No branches or pull requests

2 participants