From 13a4561cf3a5c550675cc7011bf7a0c634671e75 Mon Sep 17 00:00:00 2001 From: Tony Cabello Date: Sun, 18 Nov 2018 12:58:06 +0100 Subject: [PATCH] Motor diag showing low positions on idle --- src/main/io/osd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/io/osd.c b/src/main/io/osd.c index 09bf261c6..5b5801bc1 100644 --- a/src/main/io/osd.c +++ b/src/main/io/osd.c @@ -689,18 +689,19 @@ static bool osdDrawSingleElement(uint8_t item) } case OSD_MOTOR_DIAG: - if(areMotorsRunning()) { - int maxIdx = 0; + { int i = 0; - for(; i < getMotorCount(); i++) { - if(motor[i] > motor[maxIdx]) { - maxIdx = i; + const bool motorsRunning = areMotorsRunning(); + for (; i < getMotorCount(); i++) { + if (motorsRunning) { + buff[i] = 0x88 - scaleRange(motor[i], motorOutputLow, motorOutputHigh, 0, 8); + } else { + buff[i] = 0x88; } - buff[i] = 0x88 - scaleRange(motor[i], motorOutputLow, motorOutputHigh, 0, 8); } buff[i] = '\0'; + break; } - break; case OSD_CRAFT_NAME: // This does not strictly support iterative updating if the craft name changes at run time. But since the craft name is not supposed to be changing this should not matter, and blanking the entire length of the craft name string on update will make it impossible to configure elements to be displayed on the right hand side of the craft name.