Add link quality symbol to OSD (#8494)

Add link quality symbol to OSD
This commit is contained in:
Michael Keller 2019-06-28 19:24:35 +12:00 committed by GitHub
commit 3695b123d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 9 deletions

View File

@ -42,6 +42,7 @@
// RSSI // RSSI
#define SYM_RSSI 0x01 #define SYM_RSSI 0x01
#define SYM_LINK_QUALITY 0x7B
// Throttle Position (%) // Throttle Position (%)
#define SYM_THR 0x04 #define SYM_THR 0x04

View File

@ -880,13 +880,13 @@ static void osdElementLinkQuality(osdElementParms_t *element)
uint16_t osdLinkQuality = 0; uint16_t osdLinkQuality = 0;
if (linkQualitySource == LQ_SOURCE_RX_PROTOCOL_CRSF) { // 0-300 if (linkQualitySource == LQ_SOURCE_RX_PROTOCOL_CRSF) { // 0-300
osdLinkQuality = rxGetLinkQuality() / 3.41; osdLinkQuality = rxGetLinkQuality() / 3.41;
tfp_sprintf(element->buff, "%3d", osdLinkQuality); tfp_sprintf(element->buff, "%c%3d", SYM_LINK_QUALITY, osdLinkQuality);
} else { // 0-9 } else { // 0-9
osdLinkQuality = rxGetLinkQuality() * 10 / LINK_QUALITY_MAX_VALUE; osdLinkQuality = rxGetLinkQuality() * 10 / LINK_QUALITY_MAX_VALUE;
if (osdLinkQuality >= 10) { if (osdLinkQuality >= 10) {
osdLinkQuality = 9; osdLinkQuality = 9;
} }
tfp_sprintf(element->buff, "%1d", osdLinkQuality); tfp_sprintf(element->buff, "%c%1d", SYM_LINK_QUALITY, osdLinkQuality);
} }
} }
#endif // USE_RX_LINK_QUALITY_INFO #endif // USE_RX_LINK_QUALITY_INFO

View File

@ -244,7 +244,7 @@ TEST(LQTest, TestElement_LQ_SOURCE_NONE_SAMPLES)
osdRefresh(simulationTime); osdRefresh(simulationTime);
// then // then
displayPortTestBufferSubstring(8, 1, "9"); displayPortTestBufferSubstring(8, 1, "%c9", SYM_LINK_QUALITY);
// when updateLinkQualitySamples used 50% rounds to 4 // when updateLinkQualitySamples used 50% rounds to 4
for (int x = 0; x < LINK_QUALITY_SAMPLE_COUNT; x++) { for (int x = 0; x < LINK_QUALITY_SAMPLE_COUNT; x++) {
@ -256,7 +256,7 @@ TEST(LQTest, TestElement_LQ_SOURCE_NONE_SAMPLES)
osdRefresh(simulationTime); osdRefresh(simulationTime);
// then // then
displayPortTestBufferSubstring(8, 1, "4"); displayPortTestBufferSubstring(8, 1, "%c4", SYM_LINK_QUALITY);
} }
/* /*
@ -286,9 +286,9 @@ TEST(LQTest, TestElement_LQ_SOURCE_NONE_VALUES)
#endif #endif
// then // then
if (testdigit >= 10){ if (testdigit >= 10){
displayPortTestBufferSubstring(7, 1," 9"); displayPortTestBufferSubstring(8, 1,"%c9", SYM_LINK_QUALITY);
}else{ }else{
displayPortTestBufferSubstring(7, 1," %1d", testdigit - 1); displayPortTestBufferSubstring(8, 1,"%c%1d", SYM_LINK_QUALITY, testdigit - 1);
} }
} }
} }
@ -316,7 +316,7 @@ TEST(LQTest, TestElementLQ_PROTOCOL_CRSF_VALUES)
// then rxGetLinkQuality Osd should be x // then rxGetLinkQuality Osd should be x
displayClearScreen(&testDisplayPort); displayClearScreen(&testDisplayPort);
osdRefresh(simulationTime); osdRefresh(simulationTime);
displayPortTestBufferSubstring(8, 1,"%3d", x); displayPortTestBufferSubstring(8, 1,"%c%3d", SYM_LINK_QUALITY, x);
} }
} }
@ -367,7 +367,7 @@ TEST(LQTest, TestLQAlarm)
#ifdef DEBUG_OSD #ifdef DEBUG_OSD
printf("%d\n", i); printf("%d\n", i);
#endif #endif
displayPortTestBufferSubstring(8, 1, "9"); displayPortTestBufferSubstring(8, 1, "%c9", SYM_LINK_QUALITY);
} }
@ -387,7 +387,7 @@ TEST(LQTest, TestLQAlarm)
displayPortTestPrint(); displayPortTestPrint();
#endif #endif
if (i % 2 == 0) { if (i % 2 == 0) {
displayPortTestBufferSubstring(8, 1, "5"); displayPortTestBufferSubstring(8, 1, "%c5", SYM_LINK_QUALITY);
} else { } else {
displayPortTestBufferIsEmpty(); displayPortTestBufferIsEmpty();
} }