diff --git a/desktop/src/app/rotator/rotator.component.ts b/desktop/src/app/rotator/rotator.component.ts index d0bd81edd..20843f897 100644 --- a/desktop/src/app/rotator/rotator.component.ts +++ b/desktop/src/app/rotator/rotator.component.ts @@ -109,7 +109,7 @@ export class RotatorComponent implements AfterViewInit, OnDestroy { } private update() { - if (!this.rotator.id) { + if (this.rotator.id) { this.moving = this.rotator.moving this.reversed = this.rotator.reversed } diff --git a/nebulosa-alpaca-indi/src/main/kotlin/nebulosa/alpaca/indi/device/ASCOMDevice.kt b/nebulosa-alpaca-indi/src/main/kotlin/nebulosa/alpaca/indi/device/ASCOMDevice.kt index 1eec61374..af58c5b9d 100644 --- a/nebulosa-alpaca-indi/src/main/kotlin/nebulosa/alpaca/indi/device/ASCOMDevice.kt +++ b/nebulosa-alpaca-indi/src/main/kotlin/nebulosa/alpaca/indi/device/ASCOMDevice.kt @@ -84,23 +84,28 @@ abstract class ASCOMDevice : Device, Resettable { protected fun > Call.doRequest(): T? { try { - val response = execute().body() + val request = request() + val response = execute() + val body = response.body() - return if (response == null) { - LOG.warn("response has no body. device={}, url={}", name, request().url) + return if (body == null) { + LOG.warn("response has no body. device={}, request={} {}, response={}", name, request.method, request.url, response.code()) null - } else if (response.errorNumber != 0) { - val message = response.errorMessage + } else if (body.errorNumber != 0) { + val message = body.errorMessage if (message.isNotEmpty()) { addMessageAndFireEvent("[%s]: %s".format(LocalDateTime.now(), message)) } - // LOG.warn("unsuccessful response. device={}, code={}, message={}", name, response.errorNumber, response.errorMessage) + LOG.warn( + "unsuccessful response. device={}, request={} {}, errorNumber={}, message={}", + name, request.method, request.url, body.errorNumber, body.errorMessage + ) null } else { - response + body } } catch (e: HttpException) { LOG.error("unexpected response. device=$name", e) diff --git a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/AbstractINDIDeviceProvider.kt b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/AbstractINDIDeviceProvider.kt index 53e55e8b8..235b7e947 100644 --- a/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/AbstractINDIDeviceProvider.kt +++ b/nebulosa-indi-device/src/main/kotlin/nebulosa/indi/device/AbstractINDIDeviceProvider.kt @@ -198,35 +198,12 @@ abstract class AbstractINDIDeviceProvider : INDIDeviceProvider { } override fun close() { - cameras().forEach { - it.close() - unregisterCamera(it) - } - - mounts().forEach { - it.close() - unregisterMount(it) - } - - wheels().forEach { - it.close() - unregisterFilterWheel(it) - } - - focusers().forEach { - it.close() - unregisterFocuser(it) - } - - rotators().forEach { - it.close() - unregisterRotator(it) - } - - gps().forEach { - it.close() - unregisterGPS(it) - } + cameras().onEach(Device::close).onEach(::unregisterCamera) + mounts().onEach(Device::close).onEach(::unregisterMount) + wheels().onEach(Device::close).onEach(::unregisterFilterWheel) + focusers().onEach(Device::close).onEach(::unregisterFocuser) + rotators().onEach(Device::close).onEach(::unregisterRotator) + gps().onEach(Device::close).onEach(::unregisterGPS) cameras.clear() mounts.clear()