@@ -150,6 +150,7 @@ char djiWarningBuffer[12];
150150
151151static uint8_t armState ;
152152static bool lastArmState ;
153+ static uint16_t osdLQfinal ;
153154
154155static displayPort_t * osdDisplayPort ;
155156
@@ -179,6 +180,9 @@ static const char compassBar[] = {
179180static const uint8_t osdElementDisplayOrder [] = {
180181 OSD_MAIN_BATT_VOLTAGE ,
181182 OSD_RSSI_VALUE ,
183+ OSD_CRSF_TX ,
184+ OSD_CRSF_SNR ,
185+ OSD_CRSF_RSSI ,
182186 OSD_CROSSHAIRS ,
183187 OSD_HORIZON_SIDEBARS ,
184188 OSD_ITEM_TIMER_1 ,
@@ -488,32 +492,60 @@ static bool osdDrawSingleElement(uint8_t item)
488492 char buff [OSD_ELEMENT_BUFFER_LENGTH ] = "" ;
489493
490494 switch (item ) {
491- case OSD_RSSI_VALUE :
495+ case OSD_RSSI_VALUE : //standard RSSI and CRSF LQ
492496 {
493497 if (crsfRssi )
494498 {
495499 uint16_t osdLQ = CRSFgetLQ ();
496500 uint8_t osdRfMode = CRSFgetRFMode ();
497- uint16_t osdLQfinal = 0 ;
498- switch (osdRfMode )
501+ osdLQfinal = osdLQ ;
502+ switch (osdConfig () -> lq_format )
499503 {
500- case 0 :
501- osdLQfinal = osdLQ ;
502- break ;
503- case 1 :
504- osdLQfinal = osdLQ + 100 ;
504+
505+ case TBS :
506+
507+ switch (osdRfMode )
508+ {
509+ case 2 :
510+ osdLQfinal = osdLQ * 3 ;
511+ if (osdLQfinal < 200 )
512+ osdLQfinal = 200 ;
505513 break ;
506- case 2 :
507- osdLQfinal = osdLQ + 200 ;
514+ default :
515+ osdLQfinal = osdLQ ;
508516 break ;
509- }
517+ }
518+ if (osdLQfinal >= 300 )
519+ osdLQfinal = 300 ;
510520
511- if ( osdLQfinal >= 300 )
512- osdLQfinal = 300 ;
521+ tfp_sprintf ( buff , "%c%3d" , LINK_QUALITY , osdLQfinal );
522+ break ;
513523
514- tfp_sprintf (buff , "%c%3d" , LINK_QUALITY , osdLQfinal );
524+
525+ case MODE :
526+ if (osdLQ >=100 )
527+ osdLQfinal = 100 ;
528+ tfp_sprintf (buff , "%1d:%d" , osdRfMode , osdLQfinal );
529+ break ;
530+
531+ case FREQ :
532+ switch (osdRfMode )
533+ {
534+ case 0 :
535+ osdRfMode = 4 ;
536+ break ;
537+ case 1 :
538+ osdRfMode = 50 ;
539+ break ;
540+ case 2 :
541+ osdRfMode = 150 ;
542+ break ;
543+ }
544+ tfp_sprintf (buff , "%3dHZ:%d" , osdRfMode , osdLQfinal );
545+ break ;
515546
516547
548+ }
517549 }
518550 else
519551 {
@@ -525,16 +557,18 @@ static bool osdDrawSingleElement(uint8_t item)
525557 }
526558 break ;
527559 }
528- /*
529- case OSD_CRSF_SNR:
560+
561+ case OSD_CRSF_SNR : //crsf signal to noise ratio
530562 {
531563 if (crsfRssi )
532564 {
533- uint16_t osdSNR = CRSFgetSnR();
534- tfp_sprintf(buff, "%c%3d.%02d" , SYM_BLANK , osdSNR );
565+ uint8_t osdSNR = CRSFgetSnR ();
566+ tfp_sprintf (buff , "SN %2dDB" , osdSNR );
535567 }
568+ break ;
536569 }
537- case OSD_CRSF_TX_POWER:
570+
571+ case OSD_CRSF_TX : //crsf tx output power
538572 {
539573 if (crsfRssi )
540574 {
@@ -569,10 +603,18 @@ static bool osdDrawSingleElement(uint8_t item)
569603 osdtxpower = 0 ;
570604 break ;
571605 }
572- tfp_sprintf(buff, "%c%4d" , SYM_BLANK , osdtxpower );
606+ tfp_sprintf (buff , "%dMW" , osdtxpower );
573607 }
608+ break ;
609+ }
610+
611+ case OSD_CRSF_RSSI : //crsf rssi
612+ {
613+ uint8_t osdcrsfrssi = CRSFgetRSSI ();
614+ tfp_sprintf (buff , "-%2dDBM" , osdcrsfrssi );
615+ break ;
574616 }
575- */
617+
576618 case OSD_MAIN_BATT_VOLTAGE :
577619 buff [0 ] = osdGetBatterySymbol (osdGetBatteryAverageCellVoltage ());
578620 tfp_sprintf (buff + 1 , "%2d.%1d%c" , getBatteryVoltage () / 10 , getBatteryVoltage () % 10 , SYM_VOLT );
@@ -1208,8 +1250,8 @@ void pgResetFn_osdConfig(osdConfig_t *osdConfig)
12081250
12091251 osdConfig -> timers [OSD_TIMER_1 ] = OSD_TIMER (OSD_TIMER_SRC_ON , OSD_TIMER_PREC_SECOND , 10 );
12101252 osdConfig -> timers [OSD_TIMER_2 ] = OSD_TIMER (OSD_TIMER_SRC_TOTAL_ARMED , OSD_TIMER_PREC_SECOND , 10 );
1211-
1212- osdConfig -> lq_alarm = 170 ;
1253+ osdConfig -> lq_format = TBS ;
1254+ osdConfig -> lq_alarm = 70 ;
12131255 osdConfig -> rssi_alarm = 20 ;
12141256 osdConfig -> cap_alarm = 2200 ;
12151257 osdConfig -> alt_alarm = 100 ; // meters or feet depend on configuration
@@ -1291,24 +1333,10 @@ void osdUpdateAlarms(void)
12911333 int32_t alt = osdGetMetersToSelectedUnit (getEstimatedAltitude ()) / 100 ;
12921334 if (crsfRssi )
12931335 {
1294- uint16_t osdLQ = CRSFgetLQ ();
1295- uint8_t osdRfMode = CRSFgetRFMode ();
1296- uint16_t osdLQfinal = 0 ;
1297- switch (osdRfMode )
1298- {
1299- case 0 :
1300- osdLQfinal = osdLQ ;
1301- break ;
1302- case 1 :
1303- osdLQfinal = osdLQ + 100 ;
1304- break ;
1305- case 2 :
1306- osdLQfinal = osdLQ + 200 ;
1307- break ;
1308- }
1309-
1310- if (osdLQfinal <= osdConfig ()-> lq_alarm ) //CRSF RSSI_alarm = set to 170 (Mode1 : 60)
1311- SET_BLINK (OSD_RSSI_VALUE );
1336+ if (osdLQfinal < osdConfig ()-> lq_alarm ) //CRSF RSSI_alarm = set to 170 (Mode1 : 60)
1337+ {
1338+ SET_BLINK (OSD_RSSI_VALUE );
1339+ }
13121340 else
13131341 CLR_BLINK (OSD_RSSI_VALUE );
13141342
0 commit comments