Commit d1776967 authored by Mart Lubbers's avatar Mart Lubbers
Browse files

fix unexpected shutdown exception during regular shutdown

parent 3f0dbe67
Pipeline #54147 passed with stage
in 2 minutes and 12 seconds
......@@ -38,7 +38,8 @@ derive class iTask MTDeviceData, MTaskStatus
//* channels
(SimpleSDSLens Channels)
:: MTDeviceData =
{ deviceTasks :: Map UInt8 MTaskStatus
{ deviceShutdown :: Bool
, deviceTasks :: Map UInt8 MTaskStatus
, deviceSpec :: ? MTDeviceSpec
, deviceIds :: [UInt8]
}
......@@ -46,7 +47,8 @@ derive class iTask MTDeviceData, MTaskStatus
instance zero MTDeviceData where
zero =
{ deviceTasks = newMap
{ deviceShutdown = False
, deviceTasks = newMap
, deviceSpec = ?None
, deviceIds = [zero..UInt8 250]
}
......@@ -63,8 +65,8 @@ withDevice` verbose device devfun =
withShared ([], [MTTSpecRequest], False) \channels->
withShared zero \dev->
parallel
[(Embedded, \_->watch channels
>>* [OnValue $ ifValue thd3 \_->throw MTEUnexpectedDisconnect])
[(Embedded, \_->watch (channels >*< dev)
>>* [OnValue $ ifValue (\(ch, dev)->not dev.deviceShutdown && thd3 ch) \_->throw MTEUnexpectedDisconnect])
,(Embedded
, \stl-> appendTask Embedded (\_->catchAll
(channelSync device channels <<@ NoUserInterface)
......@@ -75,7 +77,8 @@ withDevice` verbose device devfun =
\_->appendTask Embedded (\_-> ?Just <$> devfun (MTDevice dev sdsupdates channels)) stl]
>>- \dftid->watch (sdsFocus (Right dftid) $ taskListItemValue stl)
>>* [OnValue $ ifValue (\tv->tv =: (Value _ True))
\_->upd (\(m, s, ss)->(m, s++[MTTShutdown], True)) channels
\_->upd (\d->{d & deviceShutdown=True}) dev
>-| upd (\(m, s, ss)->(m, s++[MTTShutdown], True)) channels
>-| watch channels
>>* [OnValue $ ifValue (\s->s=:(_, [], _)) \_->return ?None]
])] []
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment