@@ -511,10 +511,9 @@ private void setupPieChart() {
511511 chart .getDescription ().setEnabled (false );
512512 chart .setDrawHoleEnabled (true );
513513 chart .setHoleColor (Color .WHITE );
514- chart .setTransparentCircleColor (Color .WHITE );
515- chart .setTransparentCircleAlpha (110 );
516- chart .setHoleRadius (58f );
517- chart .setTransparentCircleRadius (61f );
514+ chart .setHoleRadius (75f );
515+ chart .setCenterTextSize (12 );
516+ chart .setCenterText ("RSSI" );
518517 chart .setHighlightPerTapEnabled (false );
519518 chart .setRotationEnabled (false );
520519 chart .setClickable (false );
@@ -809,11 +808,26 @@ private void showFecThresholdsDialog() {
809808 .setView (layout )
810809 .setPositiveButton ("OK" , (dialog , which ) -> {
811810 SharedPreferences .Editor editor = prefs .edit ();
812- try { editor .putInt ("fec_lost_to_5" , Integer .parseInt (edits [0 ].getText ().toString ())); } catch (Exception ignored ) {}
813- try { editor .putInt ("fec_recovered_to_4" , Integer .parseInt (edits [1 ].getText ().toString ())); } catch (Exception ignored ) {}
814- try { editor .putInt ("fec_recovered_to_3" , Integer .parseInt (edits [2 ].getText ().toString ())); } catch (Exception ignored ) {}
815- try { editor .putInt ("fec_recovered_to_2" , Integer .parseInt (edits [3 ].getText ().toString ())); } catch (Exception ignored ) {}
816- try { editor .putInt ("fec_recovered_to_1" , Integer .parseInt (edits [4 ].getText ().toString ())); } catch (Exception ignored ) {}
811+ try {
812+ editor .putInt ("fec_lost_to_5" , Integer .parseInt (edits [0 ].getText ().toString ()));
813+ } catch (Exception ignored ) {
814+ }
815+ try {
816+ editor .putInt ("fec_recovered_to_4" , Integer .parseInt (edits [1 ].getText ().toString ()));
817+ } catch (Exception ignored ) {
818+ }
819+ try {
820+ editor .putInt ("fec_recovered_to_3" , Integer .parseInt (edits [2 ].getText ().toString ()));
821+ } catch (Exception ignored ) {
822+ }
823+ try {
824+ editor .putInt ("fec_recovered_to_2" , Integer .parseInt (edits [3 ].getText ().toString ()));
825+ } catch (Exception ignored ) {
826+ }
827+ try {
828+ editor .putInt ("fec_recovered_to_1" , Integer .parseInt (edits [4 ].getText ().toString ()));
829+ } catch (Exception ignored ) {
830+ }
817831 editor .apply ();
818832 setFecThresholdsFromPrefs ();
819833 })
@@ -1428,6 +1442,7 @@ public void onWfbNgStatsChanged(WfbNGStats data) {
14281442 if (data .count_p_all > 0 ) {
14291443 binding .tvMessage .setVisibility (View .INVISIBLE );
14301444 binding .tvMessage .setText ("" );
1445+
14311446 if (data .count_p_dec_err > 0 ) {
14321447 binding .tvLinkStatus .setText ("Waiting for session key." );
14331448 } else {
@@ -1437,23 +1452,36 @@ public void onWfbNgStatsChanged(WfbNGStats data) {
14371452 entries .add (new PieEntry ((float ) data .count_p_dec_ok / data .count_p_all ));
14381453 entries .add (new PieEntry ((float ) data .count_p_fec_recovered / data .count_p_all ));
14391454 entries .add (new PieEntry ((float ) data .count_p_lost / data .count_p_all ));
1455+
14401456 PieDataSet dataSet = new PieDataSet (entries , "Link Status" );
14411457 dataSet .setDrawIcons (false );
14421458 dataSet .setDrawValues (false );
1459+
14431460 ArrayList <Integer > colors = new ArrayList <>();
14441461 colors .add (getColor (R .color .colorGreen ));
14451462 colors .add (getColor (R .color .colorYellow ));
14461463 colors .add (getColor (R .color .colorRed ));
14471464 dataSet .setColors (colors );
1465+
14481466 PieData pieData = new PieData (dataSet );
14491467 pieData .setValueFormatter (new PercentFormatter ());
14501468 pieData .setValueTextSize (11f );
14511469 pieData .setValueTextColor (Color .WHITE );
14521470
1471+ int rssiColor = getColor (R .color .colorGreenBg );
1472+ if (data .avg_rssi < 60 && 30 <= data .avg_rssi ) {
1473+ rssiColor = getColor (R .color .colorYellow );
1474+ } else if (data .avg_rssi < 30 ) {
1475+ rssiColor = getColor (R .color .colorRed );
1476+ }
1477+
14531478 binding .pcLinkStat .setData (pieData );
1454- binding .pcLinkStat .setCenterText ("" + data .count_p_fec_recovered );
1479+ binding .pcLinkStat .setCenterTextSize (22 );
1480+ binding .pcLinkStat .setCenterText ("" + data .avg_rssi );
1481+ binding .pcLinkStat .setCenterTextColor (rssiColor );
14551482 binding .pcLinkStat .invalidate ();
14561483
1484+ // Set link icon tint color.
14571485 int color = getColor (R .color .colorGreenBg );
14581486 if ((float ) data .count_p_fec_recovered / data .count_p_all > 0.2 ) {
14591487 color = getColor (R .color .colorYellowBg );
@@ -1462,14 +1490,15 @@ public void onWfbNgStatsChanged(WfbNGStats data) {
14621490 color = getColor (R .color .colorRedBg );
14631491 }
14641492 binding .imgLinkStatus .setImageTintList (ColorStateList .valueOf (color ));
1465- binding .tvLinkStatus .setText (String .format ("O%sD%sR%sL%s" ,
1466- paddedDigits (data .count_p_outgoing , 6 ),
1467- paddedDigits (data .count_p_dec_ok , 6 ),
1468- paddedDigits (data .count_p_fec_recovered , 6 ),
1469- paddedDigits (data .count_p_lost , 6 )));
1493+
1494+ binding .tvLinkStatus .setText (String .format ("Outgoing %3d Decoded %3d Recovered %3d Lost %3d" ,
1495+ data .count_p_outgoing ,
1496+ data .count_p_dec_ok ,
1497+ data .count_p_fec_recovered ,
1498+ data .count_p_lost ));
14701499 }
14711500 } else {
1472- binding .tvLinkStatus .setText ("No wfb-ng data. " );
1501+ binding .tvLinkStatus .setText ("No Video Link " );
14731502 }
14741503 });
14751504 }
0 commit comments