1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Oled: fix on bandwidth

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-10-20 17:01:45 +02:00
parent 476d62bff9
commit fc86fbafa0
2 changed files with 7 additions and 7 deletions

View file

@ -12,7 +12,7 @@ while [ 1 == 1 ] ; do
if [ $RXPREV -ne -1 ] ; then if [ $RXPREV -ne -1 ] ; then
let BWRX=$RX-$RXPREV let BWRX=$RX-$RXPREV
let BWTX=$TX-$TXPREV let BWTX=$TX-$TXPREV
echo "$BWRX $BWTX">/tmp/netspeed echo "$((BWRX*8)) $(($BWTX*8))">/tmp/netspeed
fi fi
RXPREV=$RX RXPREV=$RX
TXPREV=$TX TXPREV=$TX

View file

@ -774,14 +774,14 @@ void testnetspeed(int mode, int y)
{ {
case SPLIT: case SPLIT:
setTextSize(2); setTextSize(2);
if (tx < 1000) sprintf(buf, "%dB/s", tx); if (tx < 1000) sprintf(buf, "%db/s", tx);
else if (tx > 1000000) sprintf(buf, "%dMb/s", tx/1000000); else if (tx > 1000000) sprintf(buf, "%dMb/s", tx/1000000);
else sprintf(buf, "%dKb/s", tx/1000); else sprintf(buf, "%dKb/s", tx/1000);
setCursor(30,19); setCursor(30,19);
//oled_write(24); //oled_write(24);
print_str(buf); print_str(buf);
if (rx < 1000) sprintf(buf, "%dB/s", rx); if (rx < 1000) sprintf(buf, "%db/s", rx);
else if (rx > 1000000) sprintf(buf, "%dMb/s", rx/1000000); else if (rx > 1000000) sprintf(buf, "%dMb/s", rx/1000000);
else sprintf(buf, "%dKb/s", rx/1000); else sprintf(buf, "%dKb/s", rx/1000);
setCursor(30,35); setCursor(30,35);
@ -790,14 +790,14 @@ void testnetspeed(int mode, int y)
break; break;
case MERGE: case MERGE:
setTextSize(1); setTextSize(1);
if (tx < 1000) sprintf(buf, "%03dB ", tx); if (tx < 1000) sprintf(buf, "%03db ", tx);
else if (tx > 1000000) sprintf(buf, "%03dM", tx/1000000); else if (tx > 1000000) sprintf(buf, "%03dM", tx/1000000);
else sprintf(buf, "%03dK ", tx/1000); else sprintf(buf, "%03dK ", tx/1000);
setCursor((127-(2*strlen(buf)-1)*6)/2-4, y+4); setCursor((127-(2*strlen(buf)-1)*6)/2-4, y+4);
oled_write(24); oled_write(24);
print_str(buf); print_str(buf);
if (rx < 1000) sprintf(buf, "%03dB", rx); if (rx < 1000) sprintf(buf, "%03db", rx);
else if (rx > 1000000) sprintf(buf, "%03dM", rx/1000000); else if (rx > 1000000) sprintf(buf, "%03dM", rx/1000000);
else sprintf(buf, "%03dK", rx/1000); else sprintf(buf, "%03dK", rx/1000);
oled_write(25); oled_write(25);
@ -807,13 +807,13 @@ void testnetspeed(int mode, int y)
setTextSize(1); setTextSize(1);
setCursor(display_offset, y); setCursor(display_offset, y);
oled_write(24); oled_write(24);
if (tx < 1000) sprintf(buf, "%03dB ", tx); if (tx < 1000) sprintf(buf, "%03db ", tx);
else if (tx > 1000000) sprintf(buf, "%03dM", tx/1000000); else if (tx > 1000000) sprintf(buf, "%03dM", tx/1000000);
else sprintf(buf, "%03dK ", tx/1000); else sprintf(buf, "%03dK ", tx/1000);
print_str(buf); print_str(buf);
oled_write(25); oled_write(25);
if (rx < 1000) sprintf(buf, "%03dB", rx); if (rx < 1000) sprintf(buf, "%03db", rx);
else if (rx > 1000000) sprintf(buf, "%03dM", rx/1000000); else if (rx > 1000000) sprintf(buf, "%03dM", rx/1000000);
else sprintf(buf, "%03dK", rx/1000); else sprintf(buf, "%03dK", rx/1000);
print_str(buf); print_str(buf);