Skip to content

Commit

Permalink
Merge pull request #1165 from slaclab/ESROGUE-672
Browse files Browse the repository at this point in the history
Bug fix to _Ina237.py when RST execute and shadow variables out of sync to remote
  • Loading branch information
ruck314 authored Jun 12, 2024
2 parents 73c7b38 + ccd065e commit e879b47
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions python/surf/devices/ti/_Ina237.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Ina237(pr.Device):
def __init__(self,
pollInterval = 1,
senseRes = 20.E-3, # Units of Ohms
hideConfig = True,
**kwargs):

super().__init__(**kwargs)
Expand All @@ -22,21 +23,21 @@ def __init__(self,
name = 'SenseRes',
mode = 'RW',
value = senseRes,
hidden = True,
hidden = hideConfig,
))

##############
# 0h CONFIG
##############

self.add(pr.RemoteVariable(
self.add(pr.RemoteCommand(
name = 'RST',
description = 'Reset Bit. Setting this bit to 1 generates a system reset that is the same as power-on reset.',
offset = (0x0 << 2),
bitSize = 1,
bitOffset = 15,
mode = 'WO',
hidden = True,
function = lambda cmd: (cmd.post(1), self.readBlocks(checkEach=True))[0],
hidden = hideConfig,
))

self.add(pr.RemoteVariable(
Expand All @@ -47,7 +48,7 @@ def __init__(self,
bitOffset = 6,
mode = 'RW',
units = '2ms',
hidden = True,
hidden = hideConfig,
))

self.add(pr.RemoteVariable(
Expand All @@ -61,7 +62,7 @@ def __init__(self,
0 : '+/-163.84mV',
1 : '+/-40.96mV',
},
hidden = True,
hidden = hideConfig,
))

##############
Expand All @@ -75,7 +76,7 @@ def __init__(self,
bitSize = 4,
bitOffset = 12,
mode = 'RW',
hidden = True,
hidden = hideConfig,
))

self.add(pr.RemoteVariable(
Expand All @@ -85,7 +86,7 @@ def __init__(self,
bitSize = 3,
bitOffset = 9,
mode = 'RW',
hidden = True,
hidden = hideConfig,
))

self.add(pr.RemoteVariable(
Expand All @@ -95,7 +96,7 @@ def __init__(self,
bitSize = 3,
bitOffset = 6,
mode = 'RW',
hidden = True,
hidden = hideConfig,
))

self.add(pr.RemoteVariable(
Expand All @@ -105,7 +106,7 @@ def __init__(self,
bitSize = 3,
bitOffset = 3,
mode = 'RW',
hidden = True,
hidden = hideConfig,
))

self.add(pr.RemoteVariable(
Expand All @@ -115,7 +116,7 @@ def __init__(self,
bitSize = 3,
bitOffset = 0,
mode = 'RW',
hidden = True,
hidden = hideConfig,
))

##############
Expand All @@ -129,7 +130,7 @@ def __init__(self,
bitSize = 15,
bitOffset = 0,
mode = 'RW',
hidden = True,
hidden = hideConfig,
))


Expand All @@ -146,7 +147,7 @@ def __init__(self,
base = pr.Int,
mode = 'RO',
pollInterval = pollInterval,
hidden = True,
hidden = hideConfig,
))

##############
Expand All @@ -162,7 +163,7 @@ def __init__(self,
base = pr.Int,
mode = 'RO',
pollInterval = pollInterval,
hidden = True,
hidden = hideConfig,
))

##############
Expand All @@ -178,7 +179,7 @@ def __init__(self,
base = pr.Int,
mode = 'RO',
pollInterval = pollInterval,
hidden = True,
hidden = hideConfig,
))

###############################################################################
Expand Down

0 comments on commit e879b47

Please sign in to comment.