Skip to content

Commit

Permalink
Add link quality symbol to OSD (#8494)
Browse files Browse the repository at this point in the history
Add link quality symbol to OSD
  • Loading branch information
mikeller committed Jun 28, 2019
2 parents 9b04b5e + c80c3c4 commit 3695b12
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/main/drivers/max7456_symbols.h
Expand Up @@ -42,6 +42,7 @@

// RSSI
#define SYM_RSSI 0x01
#define SYM_LINK_QUALITY 0x7B

// Throttle Position (%)
#define SYM_THR 0x04
Expand Down
4 changes: 2 additions & 2 deletions src/main/osd/osd_elements.c
Expand Up @@ -880,13 +880,13 @@ static void osdElementLinkQuality(osdElementParms_t *element)
uint16_t osdLinkQuality = 0;
if (linkQualitySource == LQ_SOURCE_RX_PROTOCOL_CRSF) { // 0-300
osdLinkQuality = rxGetLinkQuality() / 3.41;
tfp_sprintf(element->buff, "%3d", osdLinkQuality);
tfp_sprintf(element->buff, "%c%3d", SYM_LINK_QUALITY, osdLinkQuality);
} else { // 0-9
osdLinkQuality = rxGetLinkQuality() * 10 / LINK_QUALITY_MAX_VALUE;
if (osdLinkQuality >= 10) {
osdLinkQuality = 9;
}
tfp_sprintf(element->buff, "%1d", osdLinkQuality);
tfp_sprintf(element->buff, "%c%1d", SYM_LINK_QUALITY, osdLinkQuality);
}
}
#endif // USE_RX_LINK_QUALITY_INFO
Expand Down
14 changes: 7 additions & 7 deletions src/test/unit/link_quality_unittest.cc
Expand Up @@ -244,7 +244,7 @@ TEST(LQTest, TestElement_LQ_SOURCE_NONE_SAMPLES)
osdRefresh(simulationTime);

// then
displayPortTestBufferSubstring(8, 1, "9");
displayPortTestBufferSubstring(8, 1, "%c9", SYM_LINK_QUALITY);

// when updateLinkQualitySamples used 50% rounds to 4
for (int x = 0; x < LINK_QUALITY_SAMPLE_COUNT; x++) {
Expand All @@ -256,7 +256,7 @@ TEST(LQTest, TestElement_LQ_SOURCE_NONE_SAMPLES)
osdRefresh(simulationTime);

// then
displayPortTestBufferSubstring(8, 1, "4");
displayPortTestBufferSubstring(8, 1, "%c4", SYM_LINK_QUALITY);

}
/*
Expand Down Expand Up @@ -286,9 +286,9 @@ TEST(LQTest, TestElement_LQ_SOURCE_NONE_VALUES)
#endif
// then
if (testdigit >= 10){
displayPortTestBufferSubstring(7, 1," 9");
displayPortTestBufferSubstring(8, 1,"%c9", SYM_LINK_QUALITY);
}else{
displayPortTestBufferSubstring(7, 1," %1d", testdigit - 1);
displayPortTestBufferSubstring(8, 1,"%c%1d", SYM_LINK_QUALITY, testdigit - 1);
}
}
}
Expand Down Expand Up @@ -316,7 +316,7 @@ TEST(LQTest, TestElementLQ_PROTOCOL_CRSF_VALUES)
// then rxGetLinkQuality Osd should be x
displayClearScreen(&testDisplayPort);
osdRefresh(simulationTime);
displayPortTestBufferSubstring(8, 1,"%3d", x);
displayPortTestBufferSubstring(8, 1,"%c%3d", SYM_LINK_QUALITY, x);

}
}
Expand Down Expand Up @@ -367,7 +367,7 @@ TEST(LQTest, TestLQAlarm)
#ifdef DEBUG_OSD
printf("%d\n", i);
#endif
displayPortTestBufferSubstring(8, 1, "9");
displayPortTestBufferSubstring(8, 1, "%c9", SYM_LINK_QUALITY);

}

Expand All @@ -387,7 +387,7 @@ TEST(LQTest, TestLQAlarm)
displayPortTestPrint();
#endif
if (i % 2 == 0) {
displayPortTestBufferSubstring(8, 1, "5");
displayPortTestBufferSubstring(8, 1, "%c5", SYM_LINK_QUALITY);
} else {
displayPortTestBufferIsEmpty();
}
Expand Down

0 comments on commit 3695b12

Please sign in to comment.