From fc86fbafa0a7db346f1fa2c2c9a22024faa4356d Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 20 Oct 2023 17:01:45 +0200 Subject: [PATCH] Oled: fix on bandwidth --- luci-app-ouad/root/usr/sbin/netspeed | 2 +- luci-app-ouad/src/Example_Code/example_app.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/luci-app-ouad/root/usr/sbin/netspeed b/luci-app-ouad/root/usr/sbin/netspeed index 6be8ca48d..0c003ee43 100755 --- a/luci-app-ouad/root/usr/sbin/netspeed +++ b/luci-app-ouad/root/usr/sbin/netspeed @@ -12,7 +12,7 @@ while [ 1 == 1 ] ; do if [ $RXPREV -ne -1 ] ; then let BWRX=$RX-$RXPREV let BWTX=$TX-$TXPREV - echo "$BWRX $BWTX">/tmp/netspeed + echo "$((BWRX*8)) $(($BWTX*8))">/tmp/netspeed fi RXPREV=$RX TXPREV=$TX diff --git a/luci-app-ouad/src/Example_Code/example_app.c b/luci-app-ouad/src/Example_Code/example_app.c index d66906588..35fe9ae63 100755 --- a/luci-app-ouad/src/Example_Code/example_app.c +++ b/luci-app-ouad/src/Example_Code/example_app.c @@ -774,14 +774,14 @@ void testnetspeed(int mode, int y) { case SPLIT: 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 sprintf(buf, "%dKb/s", tx/1000); setCursor(30,19); //oled_write(24); 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 sprintf(buf, "%dKb/s", rx/1000); setCursor(30,35); @@ -790,14 +790,14 @@ void testnetspeed(int mode, int y) break; case MERGE: 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 sprintf(buf, "%03dK ", tx/1000); setCursor((127-(2*strlen(buf)-1)*6)/2-4, y+4); oled_write(24); 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 sprintf(buf, "%03dK", rx/1000); oled_write(25); @@ -807,13 +807,13 @@ void testnetspeed(int mode, int y) setTextSize(1); setCursor(display_offset, y); 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 sprintf(buf, "%03dK ", tx/1000); print_str(buf); 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 sprintf(buf, "%03dK", rx/1000); print_str(buf);