Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d78b2d0d58 | ||
|
|
5a8279c683 |
@@ -93,6 +93,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
listenForData()
|
listenForData()
|
||||||
}.start()
|
}.start()
|
||||||
}
|
}
|
||||||
|
loadInitialReadings()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun connectToHC05() {
|
private fun connectToHC05() {
|
||||||
@@ -220,7 +221,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
humEntries.add(Entry(reading.secSinceStart.toFloat(), reading.humidity))
|
humEntries.add(Entry(reading.secSinceStart.toFloat(), reading.humidity))
|
||||||
}
|
}
|
||||||
|
|
||||||
val tempSet = LineDataSet(tempEntries, "Temperature (°C)").apply {
|
val tempSet = LineDataSet(tempEntries, getString(R.string.temp_tx)).apply {
|
||||||
color = Color.RED
|
color = Color.RED
|
||||||
lineWidth = 2f
|
lineWidth = 2f
|
||||||
setDrawCircles(false)
|
setDrawCircles(false)
|
||||||
@@ -229,7 +230,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
fillDrawable = ContextCompat.getDrawable(this@MainActivity, R.drawable.gradiant_temp)
|
fillDrawable = ContextCompat.getDrawable(this@MainActivity, R.drawable.gradiant_temp)
|
||||||
}
|
}
|
||||||
|
|
||||||
val humSet = LineDataSet(humEntries, "Humidity (%)").apply {
|
val humSet = LineDataSet(humEntries, getString(R.string.hum_tx)).apply {
|
||||||
color = Color.BLUE
|
color = Color.BLUE
|
||||||
lineWidth = 2f
|
lineWidth = 2f
|
||||||
setDrawCircles(false)
|
setDrawCircles(false)
|
||||||
@@ -274,4 +275,21 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
return pipedInput
|
return pipedInput
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun loadInitialReadings() {
|
||||||
|
val initialReadings = listOf(
|
||||||
|
SensorReading(0, 22.8f, 67.4f),
|
||||||
|
SensorReading(10, 9.0f, 70.2f),
|
||||||
|
SensorReading(20, 5.8f, 58.2f),
|
||||||
|
SensorReading(30, 12.8f, 32.1f),
|
||||||
|
SensorReading(40, 25.8f, 25.7f),
|
||||||
|
SensorReading(50, 5.8f, 72.7f)
|
||||||
|
)
|
||||||
|
sensorHistory.addAll(initialReadings)
|
||||||
|
updateChartData()
|
||||||
|
|
||||||
|
val last = initialReadings.last()
|
||||||
|
tempCircle.text = getString(R.string.temp_format, last.temperature)
|
||||||
|
humCircle.text = getString(R.string.hum_format, last.humidity)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,4 +7,6 @@
|
|||||||
<string name="is_testing_mode">Die Anwendung läuft im Testmodus, die Werte sind zufällig</string>
|
<string name="is_testing_mode">Die Anwendung läuft im Testmodus, die Werte sind zufällig</string>
|
||||||
<string name="hc05_not_found">HC-05 nicht gefunden, versuchen Sie, es über Bluetooth mit Ihrem Telefon zu koppeln</string>
|
<string name="hc05_not_found">HC-05 nicht gefunden, versuchen Sie, es über Bluetooth mit Ihrem Telefon zu koppeln</string>
|
||||||
<string name="connection_failed">Verbindung fehlgeschlagen</string>
|
<string name="connection_failed">Verbindung fehlgeschlagen</string>
|
||||||
|
<string name="temp_tx">Temperatur (°C)</string>
|
||||||
|
<string name="hum_tx">Luftfeuchtigkeit (%)</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -7,4 +7,6 @@
|
|||||||
<string name="is_testing_mode">La aplicación se está ejecutando en modo de prueba los valores son aleatorios</string>
|
<string name="is_testing_mode">La aplicación se está ejecutando en modo de prueba los valores son aleatorios</string>
|
||||||
<string name="hc05_not_found">HC-05 no encontrado, intente emparejarlo a su teléfono a través de bluetooth</string>
|
<string name="hc05_not_found">HC-05 no encontrado, intente emparejarlo a su teléfono a través de bluetooth</string>
|
||||||
<string name="connection_failed">Error de conexión</string>
|
<string name="connection_failed">Error de conexión</string>
|
||||||
|
<string name="temp_tx">Temperatura (°C)</string>
|
||||||
|
<string name="hum_tx">Humedad (%)</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -7,4 +7,6 @@
|
|||||||
<string name="is_testing_mode">L\'application est en mode de test les valeurs sont aléatoires</string>
|
<string name="is_testing_mode">L\'application est en mode de test les valeurs sont aléatoires</string>
|
||||||
<string name="hc05_not_found">HC-05 introuvable, essayez de l\'apparailler a votre téléphone en bluetooth</string>
|
<string name="hc05_not_found">HC-05 introuvable, essayez de l\'apparailler a votre téléphone en bluetooth</string>
|
||||||
<string name="connection_failed">Connexion impossible</string>
|
<string name="connection_failed">Connexion impossible</string>
|
||||||
|
<string name="temp_tx">Température (°C)</string>
|
||||||
|
<string name="hum_tx">Humidité (%)</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -7,4 +7,6 @@
|
|||||||
<string name="is_testing_mode">アプリはテストモードで動作しており、値はランダムです。</string>
|
<string name="is_testing_mode">アプリはテストモードで動作しており、値はランダムです。</string>
|
||||||
<string name="hc05_not_found">HC-05が見つかりません。ブルートゥースで携帯電話とペアリングしてみてください。</string>
|
<string name="hc05_not_found">HC-05が見つかりません。ブルートゥースで携帯電話とペアリングしてみてください。</string>
|
||||||
<string name="connection_failed">接続に失敗</string>
|
<string name="connection_failed">接続に失敗</string>
|
||||||
|
<string name="temp_tx">温度 (°C)</string>
|
||||||
|
<string name="hum_tx">湿度(%)</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -7,4 +7,6 @@
|
|||||||
<string name="is_testing_mode">应用程序在测试模式下运行,数值是随机的</string>
|
<string name="is_testing_mode">应用程序在测试模式下运行,数值是随机的</string>
|
||||||
<string name="hc05_not_found">HC-05 未找到,请尝试通过蓝牙将其与手机配对</string>
|
<string name="hc05_not_found">HC-05 未找到,请尝试通过蓝牙将其与手机配对</string>
|
||||||
<string name="connection_failed">连接失败</string>
|
<string name="connection_failed">连接失败</string>
|
||||||
|
<string name="temp_tx">温度(°C)</string>
|
||||||
|
<string name="hum_tx">湿度 (%)</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
<string name="is_testing_mode">The app is running in testing mode the values are random</string>
|
<string name="is_testing_mode">The app is running in testing mode the values are random</string>
|
||||||
<string name="hc05_not_found">HC-05 not found, try pairing it to your phone via bluetooth</string>
|
<string name="hc05_not_found">HC-05 not found, try pairing it to your phone via bluetooth</string>
|
||||||
<string name="connection_failed">Connection failed</string>
|
<string name="connection_failed">Connection failed</string>
|
||||||
|
<string name="temp_tx">Temperature (°C)</string>
|
||||||
|
<string name="hum_tx">Humidity (%)</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="temp_format" translatable="false">%.1f°C</string>
|
<string name="temp_format" translatable="false">%.1f°C</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user