Cleared warnings

This commit is contained in:
Gabriel Low
2026-09-09 22:48:06 +08:00
parent 981071ef74
commit 7cf217488a
22 changed files with 126 additions and 140 deletions
@@ -16,6 +16,7 @@ import java.io.FileOutputStream
import java.io.OutputStreamWriter
import java.text.SimpleDateFormat
import java.util.Locale
import kotlin.math.sqrt
/**
* @brief Writes one line per analyzed frame -- landmark confidence,
@@ -64,7 +65,7 @@ class DebugSessionLogger(private val appContext: Context) {
dir.mkdirs()
FileOutputStream(File(dir, fileName))
}
} catch (e: Exception) {
} catch (_: Exception) {
null
}
writer = outputStream?.let { BufferedWriter(OutputStreamWriter(it)) }
@@ -72,7 +73,7 @@ class DebugSessionLogger(private val appContext: Context) {
writer?.let {
it.write(
"timestampMs dtMs ankleL(y,lik) ankleR(y,lik) hipL(y,lik) hipR(y,lik) shoulderL(y,lik) shoulderR(y,lik) " +
"wristL(y,lik) wristR(y,lik) torsoScalePx stepCount"
"wristL(y,lik) wristR(y,lik) torsoScalePx stepCount",
)
it.newLine()
it.flush()
@@ -108,7 +109,7 @@ class DebugSessionLogger(private val appContext: Context) {
"${format(shoulderL)} ${format(shoulderR)} " +
"${format(wristL)} ${format(wristR)} " +
"${torsoScale?.let { "%.1f".format(it) } ?: "-"} " +
"$stepCount"
stepCount.toString()
try {
out.write(line)
@@ -117,7 +118,7 @@ class DebugSessionLogger(private val appContext: Context) {
// stopped mid-recording the file should still have everything
// logged up to that point rather than losing a buffered tail.
out.flush()
} catch (e: Exception) {
} catch (_: Exception) {
// A failed debug write shouldn't disrupt the actual recording.
}
}
@@ -126,7 +127,7 @@ class DebugSessionLogger(private val appContext: Context) {
fun stop() {
try {
writer?.close()
} catch (e: Exception) {
} catch (_: Exception) {
// Nothing useful to do about a failed close on a debug file.
}
writer = null
@@ -140,12 +141,12 @@ class DebugSessionLogger(private val appContext: Context) {
shoulderL: SmoothedLandmark?,
shoulderR: SmoothedLandmark?,
hipL: SmoothedLandmark?,
hipR: SmoothedLandmark?
hipR: SmoothedLandmark?,
): Float? {
val shoulder = shoulderL ?: shoulderR ?: return null
val hip = hipL ?: hipR ?: return null
val dx = shoulder.x - hip.x
val dy = shoulder.y - hip.y
return kotlin.math.sqrt(dx * dx + dy * dy).takeIf { it > 0f }
return sqrt((dx * dx + dy * dy)).takeIf { it > 0f }
}
}