Fix various golint errors.

Trim "\n" from errors.
pull/1/head
Marc-Antoine Ruel 9 years ago
parent ea63dac2c6
commit 128c086c75

@ -51,11 +51,11 @@ const oversamplingName = "Off1x2x4x8x16x"
var oversamplingIndex = [...]uint8{0, 3, 5, 7, 9, 11, 14} var oversamplingIndex = [...]uint8{0, 3, 5, 7, 9, 11, 14}
func (i Oversampling) String() string { func (o Oversampling) String() string {
if i >= Oversampling(len(oversamplingIndex)-1) { if o >= Oversampling(len(oversamplingIndex)-1) {
return fmt.Sprintf("Oversampling(%d)", i) return fmt.Sprintf("Oversampling(%d)", o)
} }
return oversamplingName[oversamplingIndex[i]:oversamplingIndex[i+1]] return oversamplingName[oversamplingIndex[o]:oversamplingIndex[o+1]]
} }
func (o Oversampling) asValue() int { func (o Oversampling) asValue() int {

@ -23,6 +23,7 @@ func (d *Display) String() string {
return "Display" return "Display"
} }
// Halt implements devices.Device. It is a noop.
func (d *Display) Halt() error { func (d *Display) Halt() error {
return nil return nil
} }

@ -113,7 +113,7 @@ func (d *Dev) makeDev(opts *Opts) error {
return fmt.Errorf("ds248x: error while reading status register: %s", err) return fmt.Errorf("ds248x: error while reading status register: %s", err)
} }
if stat[0] != 0x18 { if stat[0] != 0x18 {
return fmt.Errorf("ds248x: invalid status register value: %#x, expected 0x18\n", stat[0]) return fmt.Errorf("ds248x: invalid status register value: %#x, expected 0x18", stat[0])
} }
// Write the device configuration register to get the chip out of reset state, immediately // Write the device configuration register to get the chip out of reset state, immediately

@ -117,15 +117,15 @@ const (
type FFCState uint8 type FFCState uint8
const ( const (
// No FFC was requested. // FFCNever means no FFC was requested.
FFCNever FFCState = 0 FFCNever FFCState = 0
// FFC is in progress. It lasts 23 frames (at 27fps) so it lasts less than a second. // FFCInProgress means a FFC is in progress. It lasts 23 frames (at 27fps) so it lasts less than a second.
FFCInProgress FFCState = 1 FFCInProgress FFCState = 1
// FFC was completed successfully. // FFCComplete means FFC was completed successfully.
FFCComplete FFCState = 2 FFCComplete FFCState = 2
) )
// FFCMode // FFCMode describes the various self-calibration settings and state.
type FFCMode struct { type FFCMode struct {
FFCShutterMode FFCShutterMode // Default: FFCShutterModeExternal FFCShutterMode FFCShutterMode // Default: FFCShutterModeExternal
ShutterTempLockoutState ShutterTempLockoutState // Default: ShutterTempLockoutStateInactive ShutterTempLockoutState ShutterTempLockoutState // Default: ShutterTempLockoutStateInactive

@ -1,138 +1,136 @@
// Code generated by "stringer -output=strings_gen.go -type=CameraStatus,command,FFCShutterMode,FFCState,ShutterPos,ShutterTempLockoutState"; DO NOT EDIT. // Code generated by "stringer -output=strings_gen.go -type=CameraStatus,command,FFCShutterMode,FFCState,ShutterPos,ShutterTempLockoutState"; DO NOT EDIT.
// then manually modified to remove golint errors. :)
package cci package cci
import "fmt" import "fmt"
const _CameraStatus_name = "SystemReadySystemInitializingSystemInLowPowerModeSystemGoingIntoStandbySystemFlatFieldInProcess" const cameraStatusName = "SystemReadySystemInitializingSystemInLowPowerModeSystemGoingIntoStandbySystemFlatFieldInProcess"
var _CameraStatus_index = [...]uint8{0, 11, 29, 49, 71, 95} var cameraStatusIndex = [...]uint8{0, 11, 29, 49, 71, 95}
func (i CameraStatus) String() string { func (i CameraStatus) String() string {
if i >= CameraStatus(len(_CameraStatus_index)-1) { if i >= CameraStatus(len(cameraStatusIndex)-1) {
return fmt.Sprintf("CameraStatus(%d)", i) return fmt.Sprintf("CameraStatus(%d)", i)
} }
return _CameraStatus_name[_CameraStatus_index[i]:_CameraStatus_index[i+1]] return cameraStatusName[cameraStatusIndex[i]:cameraStatusIndex[i+1]]
} }
const _command_name = "agcEnableagcRoiSelectagcHistogramStatsagcHeqDampFactoragcHeqClipLimitHighagcHeqClipLimitLowagcHeqEmptyCountsagcHeqOutputScaleFactoragcCalculationEnablesysPingsysStatussysSerialNumbersysUptimesysHousingTemperaturesysTemperaturesysTelemetryEnablesysTelemetryLocationsysExecuteFrameAveragesysFlatFieldFramessysCustomSerialNumbersysRoiSceneStatssysRoiSceneSelectsysThermalShutdownCountsysShutterPositionsysFFCModesysFCCRunNormalizationsysFCCStatusvidColorLookupSelectvidColorLookupTransfervidFocusCalculationEnablevidFocusRoiSelectvidFocusMetricThresholdvidFocusMetricGetvidVideoFreezeEnableoemShutterProfileoemPowerDownoemPartNumberoemSoftwareRevisionoemVideoOutputEnableoemVideoOutputFormatoemVideoOutputSourceoemCustomerPartNumberoemVideoOutputConstoemCameraRebootoemFCCNormalizationTargetoemStatusoemFrameMeanIntensityoemGPIOModeSelectoemGPIOVSyncPhaseDelayoemUserDefaultsoemRestoreUserDefaultsoemThermalShutdownEnableoemBadPixeloemTemporalFilteroemColumnNoiseFilteroemPixelNoiseFilter" const commandName = "agcEnableagcRoiSelectagcHistogramStatsagcHeqDampFactoragcHeqClipLimitHighagcHeqClipLimitLowagcHeqEmptyCountsagcHeqOutputScaleFactoragcCalculationEnablesysPingsysStatussysSerialNumbersysUptimesysHousingTemperaturesysTemperaturesysTelemetryEnablesysTelemetryLocationsysExecuteFrameAveragesysFlatFieldFramessysCustomSerialNumbersysRoiSceneStatssysRoiSceneSelectsysThermalShutdownCountsysShutterPositionsysFFCModesysFCCRunNormalizationsysFCCStatusvidColorLookupSelectvidColorLookupTransfervidFocusCalculationEnablevidFocusRoiSelectvidFocusMetricThresholdvidFocusMetricGetvidVideoFreezeEnableoemShutterProfileoemPowerDownoemPartNumberoemSoftwareRevisionoemVideoOutputEnableoemVideoOutputFormatoemVideoOutputSourceoemCustomerPartNumberoemVideoOutputConstoemCameraRebootoemFCCNormalizationTargetoemStatusoemFrameMeanIntensityoemGPIOModeSelectoemGPIOVSyncPhaseDelayoemUserDefaultsoemRestoreUserDefaultsoemThermalShutdownEnableoemBadPixeloemTemporalFilteroemColumnNoiseFilteroemPixelNoiseFilter"
var _command_map = map[command]string{ var commandMap = map[command]string{
256: _command_name[0:9], 256: commandName[0:9],
264: _command_name[9:21], 264: commandName[9:21],
268: _command_name[21:38], 268: commandName[21:38],
292: _command_name[38:54], 292: commandName[38:54],
300: _command_name[54:73], 300: commandName[54:73],
304: _command_name[73:91], 304: commandName[73:91],
316: _command_name[91:108], 316: commandName[91:108],
324: _command_name[108:131], 324: commandName[108:131],
328: _command_name[131:151], 328: commandName[131:151],
512: _command_name[151:158], 512: commandName[151:158],
516: _command_name[158:167], 516: commandName[158:167],
520: _command_name[167:182], 520: commandName[167:182],
524: _command_name[182:191], 524: commandName[182:191],
528: _command_name[191:212], 528: commandName[191:212],
532: _command_name[212:226], 532: commandName[212:226],
536: _command_name[226:244], 536: commandName[226:244],
540: _command_name[244:264], 540: commandName[244:264],
544: _command_name[264:286], 544: commandName[264:286],
548: _command_name[286:304], 548: commandName[286:304],
552: _command_name[304:325], 552: commandName[304:325],
556: _command_name[325:341], 556: commandName[325:341],
560: _command_name[341:358], 560: commandName[341:358],
564: _command_name[358:381], 564: commandName[358:381],
568: _command_name[381:399], 568: commandName[381:399],
572: _command_name[399:409], 572: commandName[399:409],
576: _command_name[409:431], 576: commandName[409:431],
580: _command_name[431:443], 580: commandName[431:443],
772: _command_name[443:463], 772: commandName[443:463],
776: _command_name[463:485], 776: commandName[463:485],
780: _command_name[485:510], 780: commandName[485:510],
784: _command_name[510:527], 784: commandName[510:527],
788: _command_name[527:550], 788: commandName[527:550],
792: _command_name[550:567], 792: commandName[550:567],
804: _command_name[567:587], 804: commandName[567:587],
16484: _command_name[587:604], 16484: commandName[587:604],
18432: _command_name[604:616], 18432: commandName[604:616],
18460: _command_name[616:629], 18460: commandName[616:629],
18464: _command_name[629:648], 18464: commandName[629:648],
18468: _command_name[648:668], 18468: commandName[648:668],
18472: _command_name[668:688], 18472: commandName[668:688],
18476: _command_name[688:708], 18476: commandName[688:708],
18488: _command_name[708:729], 18488: commandName[708:729],
18492: _command_name[729:748], 18492: commandName[729:748],
18496: _command_name[748:763], 18496: commandName[748:763],
18500: _command_name[763:788], 18500: commandName[763:788],
18504: _command_name[788:797], 18504: commandName[788:797],
18508: _command_name[797:818], 18508: commandName[797:818],
18516: _command_name[818:835], 18516: commandName[818:835],
18520: _command_name[835:857], 18520: commandName[835:857],
18524: _command_name[857:872], 18524: commandName[857:872],
18528: _command_name[872:894], 18528: commandName[872:894],
18536: _command_name[894:918], 18536: commandName[894:918],
18540: _command_name[918:929], 18540: commandName[918:929],
18544: _command_name[929:946], 18544: commandName[929:946],
18548: _command_name[946:966], 18548: commandName[946:966],
18552: _command_name[966:985], 18552: commandName[966:985],
} }
func (i command) String() string { func (i command) String() string {
if str, ok := _command_map[i]; ok { if str, ok := commandMap[i]; ok {
return str return str
} }
return fmt.Sprintf("command(%d)", i) return fmt.Sprintf("command(%d)", i)
} }
const _FFCShutterMode_name = "FFCShutterModeManualFFCShutterModeAutoFFCShutterModeExternal" const ffcShutterModeName = "FFCShutterModeManualFFCShutterModeAutoFFCShutterModeExternal"
var _FFCShutterMode_index = [...]uint8{0, 20, 38, 60} var ffcShutterModeIndex = [...]uint8{0, 20, 38, 60}
func (i FFCShutterMode) String() string { func (i FFCShutterMode) String() string {
if i >= FFCShutterMode(len(_FFCShutterMode_index)-1) { if i >= FFCShutterMode(len(ffcShutterModeIndex)-1) {
return fmt.Sprintf("FFCShutterMode(%d)", i) return fmt.Sprintf("FFCShutterMode(%d)", i)
} }
return _FFCShutterMode_name[_FFCShutterMode_index[i]:_FFCShutterMode_index[i+1]] return ffcShutterModeName[ffcShutterModeIndex[i]:ffcShutterModeIndex[i+1]]
} }
const _FFCState_name = "FFCNeverFFCInProgressFFCComplete" const ffcStateName = "FFCNeverFFCInProgressFFCComplete"
var _FFCState_index = [...]uint8{0, 8, 21, 32} var ffcStateIndex = [...]uint8{0, 8, 21, 32}
func (i FFCState) String() string { func (i FFCState) String() string {
if i >= FFCState(len(_FFCState_index)-1) { if i >= FFCState(len(ffcStateIndex)-1) {
return fmt.Sprintf("FFCState(%d)", i) return fmt.Sprintf("FFCState(%d)", i)
} }
return _FFCState_name[_FFCState_index[i]:_FFCState_index[i+1]] return ffcStateName[ffcStateIndex[i]:ffcStateIndex[i+1]]
} }
const ( const (
_ShutterPos_name_0 = "ShutterPosIdleShutterPosOpenShutterPosClosedShutterPosBrakeOn" shutterPosName0 = "ShutterPosIdleShutterPosOpenShutterPosClosedShutterPosBrakeOn"
_ShutterPos_name_1 = "ShutterPosUnknown" shutterPosName1 = "ShutterPosUnknown"
) )
var ( var shutterPosIndex0 = [...]uint8{0, 14, 28, 44, 61}
_ShutterPos_index_0 = [...]uint8{0, 14, 28, 44, 61}
_ShutterPos_index_1 = [...]uint8{0, 17}
)
func (i ShutterPos) String() string { func (i ShutterPos) String() string {
switch { switch {
case 0 <= i && i <= 3: case 0 <= i && i <= 3:
return _ShutterPos_name_0[_ShutterPos_index_0[i]:_ShutterPos_index_0[i+1]] return shutterPosName0[shutterPosIndex0[i]:shutterPosIndex0[i+1]]
case i == 4294967295: case i == 4294967295:
return _ShutterPos_name_1 return shutterPosName1
default: default:
return fmt.Sprintf("ShutterPos(%d)", i) return fmt.Sprintf("ShutterPos(%d)", i)
} }
} }
const _ShutterTempLockoutState_name = "ShutterTempLockoutStateInactiveShutterTempLockoutStateHighShutterTempLockoutStateLow" const shutterTempLockoutStateName = "ShutterTempLockoutStateInactiveShutterTempLockoutStateHighShutterTempLockoutStateLow"
var _ShutterTempLockoutState_index = [...]uint8{0, 31, 58, 84} var shutterTempLockoutStateIndex = [...]uint8{0, 31, 58, 84}
func (i ShutterTempLockoutState) String() string { func (i ShutterTempLockoutState) String() string {
if i >= ShutterTempLockoutState(len(_ShutterTempLockoutState_index)-1) { if i >= ShutterTempLockoutState(len(shutterTempLockoutStateIndex)-1) {
return fmt.Sprintf("ShutterTempLockoutState(%d)", i) return fmt.Sprintf("ShutterTempLockoutState(%d)", i)
} }
return _ShutterTempLockoutState_name[_ShutterTempLockoutState_index[i]:_ShutterTempLockoutState_index[i+1]] return shutterTempLockoutStateName[shutterTempLockoutStateIndex[i]:shutterTempLockoutStateIndex[i+1]]
} }

@ -25,6 +25,7 @@ const (
// It is an implementation detail of the protocol. // It is an implementation detail of the protocol.
type DurationMS uint32 type DurationMS uint32
// ToD converts a millisecond based timing to time.Duration.
func (d DurationMS) ToD() time.Duration { func (d DurationMS) ToD() time.Duration {
return time.Duration(d) * time.Millisecond return time.Duration(d) * time.Millisecond
} }
@ -34,6 +35,7 @@ func (d DurationMS) ToD() time.Duration {
// It is an implementation detail of the protocol. // It is an implementation detail of the protocol.
type CentiK uint16 type CentiK uint16
// ToC converts a Kelvin measurement to Celsius.
func (c CentiK) ToC() devices.Celsius { func (c CentiK) ToC() devices.Celsius {
v := (int(c) - 27315) * 10 v := (int(c) - 27315) * 10
return devices.Celsius(v) return devices.Celsius(v)
@ -46,7 +48,7 @@ type Status struct {
Reserved uint16 Reserved uint16
} }
// FFCMode // FFCMode describes the various self-calibration settings and state.
type FFCMode struct { type FFCMode struct {
FFCShutterMode uint32 // Default: FFCShutterModeExternal FFCShutterMode uint32 // Default: FFCShutterModeExternal
ShutterTempLockoutState uint32 // Default: ShutterTempLockoutStateInactive ShutterTempLockoutState uint32 // Default: ShutterTempLockoutStateInactive

@ -315,7 +315,7 @@ func (m *Metadata) parseTelemetry(data []byte) error {
m.FFCTemp = rowA.FPATempLastFFC.ToC() m.FFCTemp = rowA.FPATempLastFFC.ToC()
m.FFCTempHousing = rowA.HousingTempLastFFC.ToC() m.FFCTempHousing = rowA.HousingTempLastFFC.ToC()
if rowA.StatusBits&statusMaskNil != 0 { if rowA.StatusBits&statusMaskNil != 0 {
return fmt.Errorf("\n(Status: 0x%08X) & (Mask: 0x%08X) = (Extra: 0x%08X) in 0x%08X\n", rowA.StatusBits, statusMask, rowA.StatusBits&statusMaskNil, statusMaskNil) return fmt.Errorf("lepton: (Status: 0x%08X) & (Mask: 0x%08X) = (Extra: 0x%08X) in 0x%08X", rowA.StatusBits, statusMask, rowA.StatusBits&statusMaskNil, statusMaskNil)
} }
m.FFCDesired = rowA.StatusBits&statusFFCDesired != 0 m.FFCDesired = rowA.StatusBits&statusFFCDesired != 0
m.Overtemp = rowA.StatusBits&statusOvertemp != 0 m.Overtemp = rowA.StatusBits&statusOvertemp != 0

Loading…
Cancel
Save