From 4091d5b25be97dacbfb6cb769fe8b817ede12e13 Mon Sep 17 00:00:00 2001 From: Carlos Quiroz Date: Fri, 12 Jan 2024 12:57:05 -0300 Subject: [PATCH] Set guider gains depending on dayMode --- .../server/tcs/TcsBaseControllerEpics.scala | 23 ++- .../navigate/server/tcs/TcsChannels.scala | 42 ++--- .../navigate/server/tcs/TcsEpicsSystem.scala | 68 +++++++ .../server/tcs/TelescopeGuideConfig.scala | 7 +- .../tcs/TcsBaseControllerEpicsSpec.scala | 175 +++++++++++++++++- .../server/tcs/TestTcsEpicsSystem.scala | 37 ++-- .../server/src/main/resources/NewTCC.graphql | 4 +- .../web/server/http4s/NavigateMappings.scala | 5 +- .../server/http4s/NavigateMappingsTest.scala | 1 + 9 files changed, 306 insertions(+), 56 deletions(-) diff --git a/modules/server/src/main/scala/navigate/server/tcs/TcsBaseControllerEpics.scala b/modules/server/src/main/scala/navigate/server/tcs/TcsBaseControllerEpics.scala index 7212dd4e..1f99e576 100644 --- a/modules/server/src/main/scala/navigate/server/tcs/TcsBaseControllerEpics.scala +++ b/modules/server/src/main/scala/navigate/server/tcs/TcsBaseControllerEpics.scala @@ -364,6 +364,12 @@ class TcsBaseControllerEpics[F[_]: Async: Parallel]( .verifiedRun(ConnectionTimeout) override def enableGuide(config: TelescopeGuideConfig): F[ApplyCommandResult] = { + val gains = (x: TcsCommands[F]) => + if (config.dayTimeMode) + x.guiderGainsCommands.dayTimeGains + else + x.guiderGainsCommands.defaultGains + val m1 = (x: TcsCommands[F]) => config.m1Guide match { case M1GuideConfig.M1GuideOff => x.m1GuideCommand.state(false) @@ -382,7 +388,7 @@ class TcsBaseControllerEpics[F[_]: Async: Parallel]( config.m2Guide match { case M2GuideConfig.M2GuideOff => - m1(tcsEpics.startCommand(timeout)).m2GuideCommand + m1(gains(tcsEpics.startCommand(timeout))).m2GuideCommand .state(false) .m2GuideModeCommand .coma(false) @@ -399,11 +405,7 @@ class TcsBaseControllerEpics[F[_]: Async: Parallel]( .flatMap(x => beams.map(y => (x, y))) .foldLeft( requireReset.fold( - tcsEpics - .startCommand(timeout) - .m2GuideResetCommand - .mark - .post + gains(tcsEpics.startCommand(timeout)).m2GuideResetCommand.mark.post .verifiedRun(ConnectionTimeout), ApplyCommandResult.Completed.pure[F] ) @@ -412,9 +414,10 @@ class TcsBaseControllerEpics[F[_]: Async: Parallel]( // Set tip-tilt guide for each source on each beam // TCC adds a delay between each call. Is it necessary? (r === ApplyCommandResult.Completed).fold( - tcsEpics - .startCommand(timeout) - .m2GuideConfigCommand + gains( + tcsEpics + .startCommand(timeout) + ).m2GuideConfigCommand .source(src.tag) .m2GuideConfigCommand .sampleFreq(200.0) @@ -430,7 +433,7 @@ class TcsBaseControllerEpics[F[_]: Async: Parallel]( ) }.flatMap { r => (r === ApplyCommandResult.Completed).fold( - m1(tcsEpics.startCommand(timeout)).m2GuideCommand + m1(gains(tcsEpics.startCommand(timeout))).m2GuideCommand .state(true) .m2GuideModeCommand .coma(coma) diff --git a/modules/server/src/main/scala/navigate/server/tcs/TcsChannels.scala b/modules/server/src/main/scala/navigate/server/tcs/TcsChannels.scala index e78c0e6b..09f7a2ab 100644 --- a/modules/server/src/main/scala/navigate/server/tcs/TcsChannels.scala +++ b/modules/server/src/main/scala/navigate/server/tcs/TcsChannels.scala @@ -192,17 +192,17 @@ object TcsChannels { ) case class GuiderGainsChannels[F[_]]( - p1tipGain: Channel[F, Double], - p1tiltGain: Channel[F, Double], - p1FocusGain: Channel[F, Double], + p1TipGain: Channel[F, String], + p1TiltGain: Channel[F, String], + p1FocusGain: Channel[F, String], p1Reset: Channel[F, BinaryYesNo], - p2tipGain: Channel[F, Double], - p2tiltGain: Channel[F, Double], - p2FocusGain: Channel[F, Double], + p2TipGain: Channel[F, String], + p2TiltGain: Channel[F, String], + p2FocusGain: Channel[F, String], p2Reset: Channel[F, BinaryYesNo], - oitipGain: Channel[F, Double], - oitiltGain: Channel[F, Double], - oiFocusGain: Channel[F, Double], + oiTipGain: Channel[F, String], + oiTiltGain: Channel[F, String], + oiFocusGain: Channel[F, String], oiReset: Channel[F, BinaryYesNo] ) @@ -515,18 +515,18 @@ object TcsChannels { top: String ): Resource[F, GuiderGainsChannels[F]] = for { - p1tipGain <- service.getChannel[Double](top, "pwfs1:dc:detSigInitFgGain.A") - p1tiltGain <- service.getChannel[Double](top, "pwfs1:dc:detSigInitFgGain.B") - p1FocusGain <- service.getChannel[Double](top, "pwfs1:dc:detSigInitFgGain.C") - p1Reset <- service.getChannel[BinaryYesNo](top, "pwfs1:dc:initSigInit.J") - p2tipGain <- service.getChannel[Double](top, "pwfs2:dc:detSigInitFgGain.A") - p2tiltGain <- service.getChannel[Double](top, "pwfs2:dc:detSigInitFgGain.B") - p2FocusGain <- service.getChannel[Double](top, "pwfs2:dc:detSigInitFgGain.C") - p2Reset <- service.getChannel[BinaryYesNo](top, "pwfs2:dc:initSigInit.J") - oitipGain <- service.getChannel[Double](top, "oiwfs:dc:detSigInitFgGain.A") - oitiltGain <- service.getChannel[Double](top, "oiwfs:dc:detSigInitFgGain.B") - oiFocusGain <- service.getChannel[Double](top, "oiwfs:dc:detSigInitFgGain.C") - oiReset <- service.getChannel[BinaryYesNo](top, "oiwfs:dc:initSigInit.J") + p1tipGain <- service.getChannel[String]("pwfs1:dc:detSigInitFgGain.A") + p1tiltGain <- service.getChannel[String]("pwfs1:dc:detSigInitFgGain.B") + p1FocusGain <- service.getChannel[String]("pwfs1:dc:detSigInitFgGain.C") + p1Reset <- service.getChannel[BinaryYesNo]("pwfs1:dc:initSigInit.J") + p2tipGain <- service.getChannel[String]("pwfs2:dc:detSigInitFgGain.A") + p2tiltGain <- service.getChannel[String]("pwfs2:dc:detSigInitFgGain.B") + p2FocusGain <- service.getChannel[String]("pwfs2:dc:detSigInitFgGain.C") + p2Reset <- service.getChannel[BinaryYesNo]("pwfs2:dc:initSigInit.J") + oitipGain <- service.getChannel[String]("oiwfs:dc:detSigInitFgGain.A") + oitiltGain <- service.getChannel[String]("oiwfs:dc:detSigInitFgGain.B") + oiFocusGain <- service.getChannel[String]("oiwfs:dc:detSigInitFgGain.C") + oiReset <- service.getChannel[BinaryYesNo]("oiwfs:dc:initSigInit.J") } yield GuiderGainsChannels( p1tipGain, p1tiltGain, diff --git a/modules/server/src/main/scala/navigate/server/tcs/TcsEpicsSystem.scala b/modules/server/src/main/scala/navigate/server/tcs/TcsEpicsSystem.scala index 7d0daa1f..2bd7fcf2 100644 --- a/modules/server/src/main/scala/navigate/server/tcs/TcsEpicsSystem.scala +++ b/modules/server/src/main/scala/navigate/server/tcs/TcsEpicsSystem.scala @@ -85,6 +85,9 @@ object TcsEpicsSystem { ] val m2GuideResetCmd: ParameterlessCommandChannels[F] val mountGuideCmd: Command4Channels[F, BinaryOnOff, String, Double, Double] + val p1GuiderGainsCmd: Command3Channels[F, Double, Double, Double] + val p2GuiderGainsCmd: Command3Channels[F, Double, Double, Double] + val oiGuiderGainsCmd: Command3Channels[F, Double, Double, Double] // val offsetACmd: OffsetCmd[F] // val offsetBCmd: OffsetCmd[F] @@ -841,6 +844,41 @@ object TcsEpicsSystem { ) } } + + override val guiderGainsCommands: GuiderGainsCommand[F, TcsCommands[F]] = + new GuiderGainsCommand[F, TcsCommands[F]] { + override def dayTimeGains: TcsCommands[F] = + addMultipleParams( + List( + tcsEpics.p1GuiderGainsCmd.setParam1(0.0), + tcsEpics.p1GuiderGainsCmd.setParam2(0.0), + tcsEpics.p1GuiderGainsCmd.setParam3(0.0), + tcsEpics.p2GuiderGainsCmd.setParam1(0.0), + tcsEpics.p2GuiderGainsCmd.setParam2(0.0), + tcsEpics.p2GuiderGainsCmd.setParam3(0.0), + tcsEpics.oiGuiderGainsCmd.setParam1(0.0), + tcsEpics.oiGuiderGainsCmd.setParam2(0.0), + tcsEpics.oiGuiderGainsCmd.setParam3(0.0) + ) + ) + + // TODO These hardcoded value should be configurable + override def defaultGains: TcsCommands[F] = + addMultipleParams( + List( + tcsEpics.p1GuiderGainsCmd.setParam1(0.03), + tcsEpics.p1GuiderGainsCmd.setParam2(0.03), + tcsEpics.p1GuiderGainsCmd.setParam3(0.00002), + tcsEpics.p2GuiderGainsCmd.setParam1(0.05), + tcsEpics.p2GuiderGainsCmd.setParam2(0.05), + tcsEpics.p2GuiderGainsCmd.setParam3(0.0001), + tcsEpics.oiGuiderGainsCmd.setParam1(0.08), + tcsEpics.oiGuiderGainsCmd.setParam2(0.08), + tcsEpics.oiGuiderGainsCmd.setParam3(0.00015) + ) + ) + + } } class TcsEpicsSystemImpl[F[_]: Monad: Parallel](epics: TcsEpics[F], st: TcsStatus[F]) @@ -993,6 +1031,30 @@ object TcsEpicsSystem { ) override val oiWfsCmds: WfsCommandsChannels[F] = WfsCommandsChannels.build(channels.telltale, channels.oiwfs) + + override val p1GuiderGainsCmd: Command3Channels[F, Double, Double, Double] = + Command3Channels( + channels.telltale, + channels.guiderGains.p1TipGain, + channels.guiderGains.p1TiltGain, + channels.guiderGains.p1FocusGain + ) + + override val p2GuiderGainsCmd: Command3Channels[F, Double, Double, Double] = + Command3Channels( + channels.telltale, + channels.guiderGains.p2TipGain, + channels.guiderGains.p2TiltGain, + channels.guiderGains.p2FocusGain + ) + + override val oiGuiderGainsCmd: Command3Channels[F, Double, Double, Double] = + Command3Channels( + channels.telltale, + channels.guiderGains.oiTipGain, + channels.guiderGains.oiTiltGain, + channels.guiderGains.oiFocusGain + ) } case class ParameterlessCommandChannels[F[_]: Monad]( @@ -1385,6 +1447,11 @@ object TcsEpicsSystem { def state(v: Boolean): S } + trait GuiderGainsCommand[F[_], +S] { + def dayTimeGains: S + def defaultGains: S + } + trait M1GuideConfigCommand[F[_], +S] { def weighting(v: String): S def source(v: String): S @@ -1475,6 +1542,7 @@ object TcsEpicsSystem { val m2GuideResetCommand: BaseCommand[F, TcsCommands[F]] val mountGuideCommand: MountGuideCommand[F, TcsCommands[F]] val oiWfsCommands: WfsCommands[F, TcsCommands[F]] + val guiderGainsCommands: GuiderGainsCommand[F, TcsCommands[F]] } /* diff --git a/modules/server/src/main/scala/navigate/server/tcs/TelescopeGuideConfig.scala b/modules/server/src/main/scala/navigate/server/tcs/TelescopeGuideConfig.scala index ecd54810..96bfa962 100644 --- a/modules/server/src/main/scala/navigate/server/tcs/TelescopeGuideConfig.scala +++ b/modules/server/src/main/scala/navigate/server/tcs/TelescopeGuideConfig.scala @@ -9,8 +9,9 @@ import cats.derived.* /** Data type for guide config. */ case class TelescopeGuideConfig( - mountGuide: Boolean, - m1Guide: M1GuideConfig, - m2Guide: M2GuideConfig + mountGuide: Boolean, + m1Guide: M1GuideConfig, + m2Guide: M2GuideConfig, + dayTimeMode: Boolean ) derives Eq, Show diff --git a/modules/server/src/test/scala/navigate/server/tcs/TcsBaseControllerEpicsSpec.scala b/modules/server/src/test/scala/navigate/server/tcs/TcsBaseControllerEpicsSpec.scala index e8fa490a..cf7d5eda 100644 --- a/modules/server/src/test/scala/navigate/server/tcs/TcsBaseControllerEpicsSpec.scala +++ b/modules/server/src/test/scala/navigate/server/tcs/TcsBaseControllerEpicsSpec.scala @@ -569,11 +569,184 @@ class TcsBaseControllerEpicsSpec extends CatsEffectSuite { } } + test("Enable and disable guiding default gains") { + val guideCfg = TelescopeGuideConfig( + mountGuide = true, + m1Guide = M1GuideConfig.M1GuideOn(M1Source.Oiwfs), + m2Guide = M2GuideOn(true, Set(TipTiltSource.Oiwfs)), + dayTimeMode = false + ) + + for { + x <- createController + (st, ctr) = x + _ <- ctr.enableGuide(guideCfg) + r1 <- st.get + _ <- ctr.disableGuide + r2 <- st.get + } yield { + assert(r1.m1Guide.connected) + assert(r1.m1GuideConfig.source.connected) + assert(r1.m1GuideConfig.frames.connected) + assert(r1.m1GuideConfig.weighting.connected) + assert(r1.m1GuideConfig.filename.connected) + assert(r1.m2Guide.connected) + assert(r1.m2GuideConfig.source.connected) + assert(r1.m2GuideConfig.beam.connected) + assert(r1.m2GuideConfig.filter.connected) + assert(r1.m2GuideConfig.samplefreq.connected) + assert(r1.m2GuideConfig.reset.connected) + assert(r1.m2GuideMode.connected) + assert(r1.m2GuideReset.connected) + assert(r1.mountGuide.mode.connected) + assert(r1.mountGuide.source.connected) + assert(r1.guiderGains.p1TipGain.connected) + assert(r1.guiderGains.p1TiltGain.connected) + assert(r1.guiderGains.p1FocusGain.connected) + assert(r1.guiderGains.p2TipGain.connected) + assert(r1.guiderGains.p2TiltGain.connected) + assert(r1.guiderGains.p2FocusGain.connected) + assert(r1.guiderGains.oiTipGain.connected) + assert(r1.guiderGains.oiTiltGain.connected) + assert(r1.guiderGains.oiFocusGain.connected) + + assertEquals(r1.m1Guide.value.flatMap(Enumerated[BinaryOnOff].fromTag), BinaryOnOff.On.some) + assertEquals(r1.m1GuideConfig.source.value.flatMap(Enumerated[M1Source].fromTag), + M1Source.Oiwfs.some + ) + assertEquals(r1.m1GuideConfig.frames.value.flatMap(_.toIntOption), 1.some) + assertEquals(r1.m1GuideConfig.weighting.value, "none".some) + assertEquals(r1.m1GuideConfig.filename.value, "".some) + assertEquals(r1.m2Guide.value.flatMap(Enumerated[BinaryOnOff].fromTag), BinaryOnOff.On.some) + assertEquals(r1.m2GuideConfig.source.value.flatMap(Enumerated[TipTiltSource].fromTag), + TipTiltSource.Oiwfs.some + ) + assertEquals(r1.m2GuideConfig.beam.value, "B".some) + assertEquals(r1.m2GuideConfig.filter.value, "raw".some) + assertEquals(r1.m2GuideConfig.samplefreq.value.flatMap(_.toDoubleOption), 200.0.some) + assertEquals(r1.m2GuideConfig.reset.value.flatMap(Enumerated[BinaryOnOff].fromTag), + BinaryOnOff.Off.some + ) + assertEquals(r1.m2GuideMode.value.flatMap(Enumerated[BinaryOnOff].fromTag), + BinaryOnOff.On.some + ) + assertEquals(r1.m2GuideReset.value, CadDirective.MARK.some) + assertEquals(r1.mountGuide.mode.value.flatMap(Enumerated[BinaryOnOff].fromTag), + BinaryOnOff.On.some + ) + assertEquals(r1.mountGuide.source.value, "SCS".some) + + assertEquals(r2.m1Guide.value.flatMap(Enumerated[BinaryOnOff].fromTag), BinaryOnOff.Off.some) + assertEquals(r2.m2Guide.value.flatMap(Enumerated[BinaryOnOff].fromTag), BinaryOnOff.Off.some) + assertEquals(r2.mountGuide.mode.value.flatMap(Enumerated[BinaryOnOff].fromTag), + BinaryOnOff.Off.some + ) + assertEquals(r1.guiderGains.p1TipGain.value, "0.03".some) + assertEquals(r1.guiderGains.p1TiltGain.value, "0.03".some) + assertEquals(r1.guiderGains.p1FocusGain.value, "2.0E-5".some) + + assertEquals(r1.guiderGains.p2TipGain.value, "0.05".some) + assertEquals(r1.guiderGains.p2TiltGain.value, "0.05".some) + assertEquals(r1.guiderGains.p2FocusGain.value, "1.0E-4".some) + + assertEquals(r1.guiderGains.oiTipGain.value, "0.08".some) + assertEquals(r1.guiderGains.oiTiltGain.value, "0.08".some) + assertEquals(r1.guiderGains.oiFocusGain.value, "1.5E-4".some) + } + } + + test("Enable and disable guiding day mode") { + val guideCfg = TelescopeGuideConfig( + mountGuide = true, + m1Guide = M1GuideConfig.M1GuideOn(M1Source.Oiwfs), + m2Guide = M2GuideOn(true, Set(TipTiltSource.Oiwfs)), + dayTimeMode = true + ) + + for { + x <- createController + (st, ctr) = x + _ <- ctr.enableGuide(guideCfg) + r1 <- st.get + _ <- ctr.disableGuide + r2 <- st.get + } yield { + assert(r1.m1Guide.connected) + assert(r1.m1GuideConfig.source.connected) + assert(r1.m1GuideConfig.frames.connected) + assert(r1.m1GuideConfig.weighting.connected) + assert(r1.m1GuideConfig.filename.connected) + assert(r1.m2Guide.connected) + assert(r1.m2GuideConfig.source.connected) + assert(r1.m2GuideConfig.beam.connected) + assert(r1.m2GuideConfig.filter.connected) + assert(r1.m2GuideConfig.samplefreq.connected) + assert(r1.m2GuideConfig.reset.connected) + assert(r1.m2GuideMode.connected) + assert(r1.m2GuideReset.connected) + assert(r1.mountGuide.mode.connected) + assert(r1.mountGuide.source.connected) + assert(r1.guiderGains.p1TipGain.connected) + assert(r1.guiderGains.p1TiltGain.connected) + assert(r1.guiderGains.p1FocusGain.connected) + assert(r1.guiderGains.p2TipGain.connected) + assert(r1.guiderGains.p2TiltGain.connected) + assert(r1.guiderGains.p2FocusGain.connected) + assert(r1.guiderGains.oiTipGain.connected) + assert(r1.guiderGains.oiTiltGain.connected) + assert(r1.guiderGains.oiFocusGain.connected) + + assertEquals(r1.m1Guide.value.flatMap(Enumerated[BinaryOnOff].fromTag), BinaryOnOff.On.some) + assertEquals(r1.m1GuideConfig.source.value.flatMap(Enumerated[M1Source].fromTag), + M1Source.Oiwfs.some + ) + assertEquals(r1.m1GuideConfig.frames.value.flatMap(_.toIntOption), 1.some) + assertEquals(r1.m1GuideConfig.weighting.value, "none".some) + assertEquals(r1.m1GuideConfig.filename.value, "".some) + assertEquals(r1.m2Guide.value.flatMap(Enumerated[BinaryOnOff].fromTag), BinaryOnOff.On.some) + assertEquals(r1.m2GuideConfig.source.value.flatMap(Enumerated[TipTiltSource].fromTag), + TipTiltSource.Oiwfs.some + ) + assertEquals(r1.m2GuideConfig.beam.value, "B".some) + assertEquals(r1.m2GuideConfig.filter.value, "raw".some) + assertEquals(r1.m2GuideConfig.samplefreq.value.flatMap(_.toDoubleOption), 200.0.some) + assertEquals(r1.m2GuideConfig.reset.value.flatMap(Enumerated[BinaryOnOff].fromTag), + BinaryOnOff.Off.some + ) + assertEquals(r1.m2GuideMode.value.flatMap(Enumerated[BinaryOnOff].fromTag), + BinaryOnOff.On.some + ) + assertEquals(r1.m2GuideReset.value, CadDirective.MARK.some) + assertEquals(r1.mountGuide.mode.value.flatMap(Enumerated[BinaryOnOff].fromTag), + BinaryOnOff.On.some + ) + assertEquals(r1.mountGuide.source.value, "SCS".some) + + assertEquals(r2.m1Guide.value.flatMap(Enumerated[BinaryOnOff].fromTag), BinaryOnOff.Off.some) + assertEquals(r2.m2Guide.value.flatMap(Enumerated[BinaryOnOff].fromTag), BinaryOnOff.Off.some) + assertEquals(r2.mountGuide.mode.value.flatMap(Enumerated[BinaryOnOff].fromTag), + BinaryOnOff.Off.some + ) + assertEquals(r1.guiderGains.p1TipGain.value, "0.0".some) + assertEquals(r1.guiderGains.p1TiltGain.value, "0.0".some) + assertEquals(r1.guiderGains.p1FocusGain.value, "0.0".some) + + assertEquals(r1.guiderGains.p2TipGain.value, "0.0".some) + assertEquals(r1.guiderGains.p2TiltGain.value, "0.0".some) + assertEquals(r1.guiderGains.p2FocusGain.value, "0.0".some) + + assertEquals(r1.guiderGains.oiTipGain.value, "0.0".some) + assertEquals(r1.guiderGains.oiTiltGain.value, "0.0".some) + assertEquals(r1.guiderGains.oiFocusGain.value, "0.0".some) + } + } + test("Enable and disable guiding") { val guideCfg = TelescopeGuideConfig( mountGuide = true, m1Guide = M1GuideConfig.M1GuideOn(M1Source.Oiwfs), - m2Guide = M2GuideOn(true, Set(TipTiltSource.Oiwfs)) + m2Guide = M2GuideOn(true, Set(TipTiltSource.Oiwfs)), + false ) for { diff --git a/modules/server/src/test/scala/navigate/server/tcs/TestTcsEpicsSystem.scala b/modules/server/src/test/scala/navigate/server/tcs/TestTcsEpicsSystem.scala index 7cbe617f..850cdf8c 100644 --- a/modules/server/src/test/scala/navigate/server/tcs/TestTcsEpicsSystem.scala +++ b/modules/server/src/test/scala/navigate/server/tcs/TestTcsEpicsSystem.scala @@ -2,6 +2,7 @@ // For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause package navigate.server.tcs + import cats.Applicative import cats.Monad import cats.Parallel @@ -174,17 +175,17 @@ object TestTcsEpicsSystem { } case class GuiderGainsState( - p1tipGain: TestChannel.State[Double], - p1tiltGain: TestChannel.State[Double], - p1FocusGain: TestChannel.State[Double], + p1TipGain: TestChannel.State[String], + p1TiltGain: TestChannel.State[String], + p1FocusGain: TestChannel.State[String], p1Reset: TestChannel.State[BinaryYesNo], - p2tipGain: TestChannel.State[Double], - p2tiltGain: TestChannel.State[Double], - p2FocusGain: TestChannel.State[Double], + p2TipGain: TestChannel.State[String], + p2TiltGain: TestChannel.State[String], + p2FocusGain: TestChannel.State[String], p2Reset: TestChannel.State[BinaryYesNo], - oitipGain: TestChannel.State[Double], - oitiltGain: TestChannel.State[Double], - oiFocusGain: TestChannel.State[Double], + oiTipGain: TestChannel.State[String], + oiTiltGain: TestChannel.State[String], + oiFocusGain: TestChannel.State[String], oiReset: TestChannel.State[BinaryYesNo] ) @@ -671,17 +672,17 @@ object TestTcsEpicsSystem { s: Ref[F, State], l: Lens[State, GuiderGainsState] ): GuiderGainsChannels[F] = GuiderGainsChannels( - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.p1tipGain))), - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.p1tiltGain))), - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.p1FocusGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.p1TipGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.p1TiltGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.p1FocusGain))), new TestChannel[F, State, BinaryYesNo](s, l.andThen(Focus[GuiderGainsState](_.p1Reset))), - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.p2tipGain))), - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.p2tiltGain))), - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.p2FocusGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.p2TipGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.p2TiltGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.p2FocusGain))), new TestChannel[F, State, BinaryYesNo](s, l.andThen(Focus[GuiderGainsState](_.p2Reset))), - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.oitipGain))), - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.oitiltGain))), - new TestChannel[F, State, Double](s, l.andThen(Focus[GuiderGainsState](_.oiFocusGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.oiTipGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.oiTiltGain))), + new TestChannel[F, State, String](s, l.andThen(Focus[GuiderGainsState](_.oiFocusGain))), new TestChannel[F, State, BinaryYesNo](s, l.andThen(Focus[GuiderGainsState](_.oiReset))) ) def buildChannels[F[_]: Applicative](s: Ref[F, State]): TcsChannels[F] = diff --git a/modules/web/server/src/main/resources/NewTCC.graphql b/modules/web/server/src/main/resources/NewTCC.graphql index afa0280d..d7529a36 100644 --- a/modules/web/server/src/main/resources/NewTCC.graphql +++ b/modules/web/server/src/main/resources/NewTCC.graphql @@ -154,8 +154,8 @@ input GuideConfigurationInput { m1Input: M1CorrectionSource """Tip-tilt offload to the mount enabled""" mountOffload: Boolean! - #"""Flag for day time tests. It sets all gains to 0""" - #daytimeMode: Boolean! + """Flag for day time tests. It sets all gains to 0""" + daytimeMode: Boolean! } enum LogLevel { diff --git a/modules/web/server/src/main/scala/navigate/web/server/http4s/NavigateMappings.scala b/modules/web/server/src/main/scala/navigate/web/server/http4s/NavigateMappings.scala index ee36252c..246fa952 100644 --- a/modules/web/server/src/main/scala/navigate/web/server/http4s/NavigateMappings.scala +++ b/modules/web/server/src/main/scala/navigate/web/server/http4s/NavigateMappings.scala @@ -659,6 +659,8 @@ object NavigateMappings extends GrackleParsers { val coma = l.collectFirst { case ("m2Coma", BooleanValue(v)) => v }.exists(identity) + val dayTimeMode = l.collectFirst { case ("daytimeMode", BooleanValue(v)) => v }.exists(identity) + l.collectFirst { case ("mountOffload", BooleanValue(v)) => v } .map { mount => TelescopeGuideConfig( @@ -667,7 +669,8 @@ object NavigateMappings extends GrackleParsers { m2.isEmpty.fold( M2GuideConfig.M2GuideOff, M2GuideConfig.M2GuideOn(coma && m1.isDefined, m2.toSet) - ) + ), + dayTimeMode ) } } diff --git a/modules/web/server/src/test/scala/navigate/web/server/http4s/NavigateMappingsTest.scala b/modules/web/server/src/test/scala/navigate/web/server/http4s/NavigateMappingsTest.scala index 23e138f3..394b320c 100644 --- a/modules/web/server/src/test/scala/navigate/web/server/http4s/NavigateMappingsTest.scala +++ b/modules/web/server/src/test/scala/navigate/web/server/http4s/NavigateMappingsTest.scala @@ -564,6 +564,7 @@ class NavigateMappingsTest extends CatsEffectSuite { | m2Coma: true | m1Input: OIWFS | mountOffload: true + | daytimeMode: false | } |) { | result