Graph View - telemetry keys flicker and reorder when keys differ on every packet
Closed this issue · 1 comments
NoahBres commented
Key selection flickers and reorders.
Implement opmode lifecycle aware key caching like PR #55
2021-03-14.00-20-33.mp4
Opmode code causing this behavior:
@Config
@TeleOp
class RampTest : LinearOpMode() {
companion object {
@JvmField
var INCREASE = 0.005
@JvmField
var paused = false
}
var progress = 0.0
var increasing = true
var counter = 0
override fun runOpMode() {
telemetry = MultipleTelemetry(telemetry, FtcDashboard.getInstance().telemetry)
waitForStart()
while (!isStopRequested) {
telemetry.clear()
if (gamepad1.a) {
paused = true;
} else if (gamepad1.b) {
paused = false;
}
if (!paused) {
if (increasing)
progress += INCREASE;
else
progress -= INCREASE;
if (progress >= 100)
increasing = false;
else if (progress <= 0)
increasing = true;
telemetry.addData("x", SineWaveOpMode.AMPLITUDE * Math.sin(
2 * Math.PI * SineWaveOpMode.FREQUENCY * runtime + Math.toRadians(SineWaveOpMode.PHASE)
))
telemetry.addData("progress", progress)
}
counter++
if (counter % 3 == 0)
telemetry.addData("three", counter)
val fizz = if (((counter % 5) == 0) && ((counter % 7) == 0))
"fizzbuzz"
else if ((counter % 5) == 0)
"fizz"
else if ((counter % 7) == 0)
"buzz"
else
counter
telemetry.addData("fizz", fizz)
if(counter % 5 == 0)
telemetry.addLine("Sonata No. " + counter)
telemetry.update()
}
}
}
Flickering just caused because telemetry is cleared on every loop and the same data keys aren't added every time. If you encounter this problem just be sure to add the same data keys every time.
rbrott commented
Fixed in master
👍