Compare commits
2 Commits
59eb3c7440
...
experiment
| Author | SHA1 | Date | |
|---|---|---|---|
| 682af406f5 | |||
| 0557622dc3 |
@@ -23,6 +23,7 @@ import com.helible.pilot.components.deviceScreen.DeviceControlScreen
|
||||
import com.helible.pilot.components.deviceScreen.defaultDeviceActionsList
|
||||
import com.helible.pilot.components.PidSettingsPage
|
||||
import com.helible.pilot.components.scannerScreen.ScannerScreen
|
||||
import com.helible.pilot.dataclasses.DeviceStatus
|
||||
import com.helible.pilot.permissions.PermissionsLauncher
|
||||
import com.helible.pilot.permissions.PermissionsRequest
|
||||
import com.helible.pilot.permissions.RequestHardwareFeatures
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.helible.pilot.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.widget.Spinner
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -70,7 +71,7 @@ fun CalibrationPage(
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Preview(showSystemUi = true)
|
||||
@Composable
|
||||
fun CalibrationPagePreview() {
|
||||
Surface {
|
||||
|
||||
@@ -63,11 +63,11 @@ fun RotorsTestPage(
|
||||
Slider(
|
||||
value = rotorsDuty.r2.toFloat(),
|
||||
onValueChange = { setRotorsDuty(rotorsDuty.copy(r2 = it.toInt().toShort())) },
|
||||
valueRange = -5000f..5000f,
|
||||
valueRange = 0f..5000f,
|
||||
steps = 10
|
||||
)
|
||||
Text(
|
||||
text = "При перемещении слайдера вправо ротор 1 должен вращаться по часовой стрелке, если смотреть сверху.",
|
||||
text = "При отклонении слайдера вправо от центра ротор 1 должен вращаться по часовой стрелке, а при отклонении влево - против часовой, если смотреть сверху.",
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
@@ -79,13 +79,14 @@ fun RotorsTestPage(
|
||||
Slider(
|
||||
value = rotorsDuty.r3.toFloat(),
|
||||
onValueChange = { setRotorsDuty(rotorsDuty.copy(r3 = it.toInt().toShort())) },
|
||||
valueRange = 0f..5000f,
|
||||
valueRange = -5000f..5000f,
|
||||
steps = 10
|
||||
)
|
||||
Text(
|
||||
text = "При отклонении слайдера вправо от центра ротор 1 должен вращаться по часовой стрелке, а при отклонении влево - против часовой, если смотреть сверху.",
|
||||
text = "При перемещении слайдера вправо ротор 1 должен вращаться по часовой стрелке, если смотреть сверху.",
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
|
||||
FloatingActionButton(
|
||||
onClick = { stopRotors() },
|
||||
containerColor = Color(245, 47, 7),
|
||||
@@ -102,7 +103,7 @@ fun RotorsTestPage(
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Preview(showBackground = true, showSystemUi = true)
|
||||
@Composable
|
||||
fun RotorsTestPagePreview() {
|
||||
TestblueTheme {
|
||||
|
||||
@@ -27,6 +27,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.helible.pilot.R
|
||||
import com.helible.pilot.dataclasses.BluetoothUiState
|
||||
import com.helible.pilot.dataclasses.DeviceState
|
||||
import com.helible.pilot.dataclasses.DeviceStatus
|
||||
import com.helible.pilot.viewmodels.AppPreferences
|
||||
|
||||
@@ -103,7 +104,14 @@ fun DeviceBadge(
|
||||
@Composable
|
||||
fun DeviceBadgePreview() {
|
||||
DeviceBadge(
|
||||
bluetoothUiState = BluetoothUiState(isConnected = true),
|
||||
bluetoothUiState = BluetoothUiState(
|
||||
isConnected = false,
|
||||
isConnecting = true,
|
||||
deviceState = DeviceState(
|
||||
status = DeviceStatus.Idle,
|
||||
batteryCharge = 50,
|
||||
)
|
||||
),
|
||||
tryToReconnect = {},
|
||||
getPreferences = { AppPreferences("Helicopter", "AA:BB:CC:FF:DD") }
|
||||
)
|
||||
|
||||
@@ -22,7 +22,6 @@ class BluetoothDataTransferService(
|
||||
return flow {
|
||||
if (!socket.isConnected)
|
||||
return@flow
|
||||
|
||||
val buffer = BufferedInputStream(socket.inputStream, maxPackageSize)
|
||||
while (true) {
|
||||
val message: String = try {
|
||||
@@ -39,9 +38,11 @@ class BluetoothDataTransferService(
|
||||
emit(GeneralMessage(messageType, messageData))
|
||||
}
|
||||
} catch (e: NoSuchElementException) {
|
||||
Log.e("BluetoothController", "Message type is invalid: $message")
|
||||
Log.e("BluetoothController", "Message type is invalid: ${e.message}")
|
||||
} catch (e: NumberFormatException) {
|
||||
Log.e("BluetoothController", "Message invalid, may be device buffer congested: $message")
|
||||
Log.e("BluetoothController", "Message invalid, may be device buffer congested: ${e.message}")
|
||||
} catch (e: Exception) {
|
||||
Log.e("BluetoothController", "Unknown error: ${e.message}")
|
||||
}
|
||||
}
|
||||
}.flowOn(Dispatchers.IO)
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
<string name="app_name">Digital Pilot</string>
|
||||
<string name="calibration_description">Расположите устройство на ровной горизонтальной поверхности, чтобы сани вертолета полностью лежали на ней. Нажмите кнопку калибровки ниже и ждите её окончания, не создавая тряски.</string>
|
||||
<string name="p_pid_value_description">Сначала подберите значение коэффицента P, которое балансирует между слишком низкой и слишком высокой чувствительностью.</string>
|
||||
<string name="i_pid_value_description">Затем подберите значение коэффицента I, которое уберёт нежелательный дрейв, но не повлияет на отзывчивость.</string>
|
||||
<string name="i_pid_value_description">Затем подберите значение коэффицента I, которое уберёт нежелательный дрейф, но не повлияет на отзывчивость.</string>
|
||||
<string name="d_pid_value_description">После установите значение коэффицента D таким образом, чтобы обеспечить более стабильное и плавное управление.</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user