Skip to content

Commit cdd7418

Browse files
LucaRoth-EnQSsthelen-enqs
authored andcommitted
refined some comments and a variable name
1 parent 8a2cfe3 commit cdd7418

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

usecases/cs/lpc/usecase.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (e *LPC) deviceConfigurationWriteCB(msg *spineapi.Message) {
210210
return
211211
}
212212

213-
dcs, err := server.NewDeviceConfiguration(e.LocalEntity)
213+
dc, err := server.NewDeviceConfiguration(e.LocalEntity)
214214
if err != nil {
215215
return
216216
}
@@ -219,10 +219,9 @@ func (e *LPC) deviceConfigurationWriteCB(msg *spineapi.Message) {
219219
var failsafeDuration *time.Duration = nil
220220
for _, deviceKeyValueData := range data.DeviceConfigurationKeyValueData {
221221

222-
description, err := dcs.GetKeyValueDescriptionFoKeyId(*deviceKeyValueData.KeyId)
222+
description, err := dc.GetKeyValueDescriptionFoKeyId(*deviceKeyValueData.KeyId)
223223
if description == nil || err != nil {
224-
logging.Log().Debug("LPC deviceConfigurationWriteCB: no device configuration for KeyID %d found on this usecase, possibly write message for other usecase")
225-
// if no description is found this write request is presumably for another usecase
224+
logging.Log().Debug("LPC deviceConfigurationWriteCB: no device configuration for KeyID %d found")
226225
continue
227226
}
228227

@@ -241,6 +240,7 @@ func (e *LPC) deviceConfigurationWriteCB(msg *spineapi.Message) {
241240
}
242241
}
243242

243+
// Only ask for write approval if at least one of the configurations we care about is trying to be set
244244
if failsafeDuration != nil || failsafeLimit != nil {
245245
e.pendingDeviceConfigMux.Lock()
246246
if _, ok := e.pendingDeviceConfigs[*msg.RequestHeader.MsgCounter]; !ok {
@@ -255,7 +255,7 @@ func (e *LPC) deviceConfigurationWriteCB(msg *spineapi.Message) {
255255
}
256256
e.pendingDeviceConfigMux.Unlock()
257257
} else {
258-
// As neither a failsafe duration nor a failsafe limit were set this message does not pertain to this callback so we accept
258+
// If neither a failsafe duration nor a failsafe limit were set this message does not pertain to this callback so we accept
259259
e.approveOrDenyDeviceConfiguration(msg, true, "")
260260
}
261261
}

usecases/cs/lpp/usecase.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func (e *LPP) deviceConfigurationWriteCB(msg *spineapi.Message) {
210210
return
211211
}
212212

213-
dcs, err := server.NewDeviceConfiguration(e.LocalEntity)
213+
dc, err := server.NewDeviceConfiguration(e.LocalEntity)
214214
if err != nil {
215215
return
216216
}
@@ -219,10 +219,9 @@ func (e *LPP) deviceConfigurationWriteCB(msg *spineapi.Message) {
219219
var failsafeDuration *time.Duration = nil
220220
for _, deviceKeyValueData := range data.DeviceConfigurationKeyValueData {
221221

222-
description, err := dcs.GetKeyValueDescriptionFoKeyId(*deviceKeyValueData.KeyId)
222+
description, err := dc.GetKeyValueDescriptionFoKeyId(*deviceKeyValueData.KeyId)
223223
if description == nil || err != nil {
224-
logging.Log().Debug("LPP deviceConfigurationWriteCB: no device configuration for KeyID %d found on this usecase, possibly write message for other usecase")
225-
// if no description is found this write request is presumably for another usecase
224+
logging.Log().Debug("LPP deviceConfigurationWriteCB: no device configuration for KeyID %d found")
226225
continue
227226
}
228227

@@ -241,6 +240,7 @@ func (e *LPP) deviceConfigurationWriteCB(msg *spineapi.Message) {
241240
}
242241
}
243242

243+
// Only ask for write approval if at least one of the configurations we care about is trying to be set
244244
if failsafeDuration != nil || failsafeLimit != nil {
245245
e.pendingDeviceConfigMux.Lock()
246246
if _, ok := e.pendingDeviceConfigs[*msg.RequestHeader.MsgCounter]; !ok {
@@ -255,7 +255,7 @@ func (e *LPP) deviceConfigurationWriteCB(msg *spineapi.Message) {
255255
}
256256
e.pendingDeviceConfigMux.Unlock()
257257
} else {
258-
// As neither a failsafe duration nor a failsafe limit were set this message does not pertain to this callback so we accept
258+
// If neither a failsafe duration nor a failsafe limit were set this message does not pertain to this callback so we accept
259259
e.approveOrDenyDeviceConfiguration(msg, true, "")
260260
}
261261
}

0 commit comments

Comments
 (0)