Added negative elevation filtering when sent via BT/Network (#164)

This commit is contained in:
Arty Bishop committed 2025-09-07 15:22:06 +01:00
1 parent c0debc038a
commit c910e37d00
13 files changed
+49 -19

No files matched your search

@@ -52,11 +52,12 @@ class DataReporter(private val reporterScope: CoroutineScope) {
fun reportRotation(server: String, port: Int, azimuth: Double, elevation: Double) {
rotationReporting = reporterScope.launch {
val newElevation = if (elevation > 0.0) elevation else 0.0
runCatching {
if (rotationSocketChannel == null) {
rotationSocketChannel = SocketChannel.open(InetSocketAddress(server, port))
} else {
val buffer = ByteBuffer.wrap("\\P $azimuth $elevation\n".toByteArray())
val buffer = ByteBuffer.wrap("\\P $azimuth $newElevation\n".toByteArray())
rotationSocketChannel?.write(buffer)
}
}.onFailure { error ->