diff --git a/BlockDevice_ioStatsMeter.c b/BlockDevice_ioStatsMeter.c index 9dccbde..95532cd 100644 --- a/BlockDevice_ioStatsMeter.c +++ b/BlockDevice_ioStatsMeter.c @@ -26,7 +26,6 @@ static void BlockDevice_sda_ioStatsMeter_setValues(Meter* this, char* buffer, in char block_device[80]; static double old = 0.; static double now = 0.; - static int flash = 0; static unsigned long sec_size = 0; FILE *fp; @@ -81,11 +80,7 @@ static void BlockDevice_sda_ioStatsMeter_setValues(Meter* this, char* buffer, in Platform_BlockDevice_sda_stats.write_sectors_comp = Platform_BlockDevice_sda_stats.write_sectors; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavailable"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavailable"); } } @@ -112,7 +107,6 @@ static void BlockDevice_sdb_ioStatsMeter_setValues(Meter* this, char* buffer, in char block_device[80]; static double old = 0.; static double now = 0.; - static int flash = 0; static unsigned long sec_size = 0; FILE *fp; @@ -167,11 +161,7 @@ static void BlockDevice_sdb_ioStatsMeter_setValues(Meter* this, char* buffer, in Platform_BlockDevice_sdb_stats.write_sectors_comp = Platform_BlockDevice_sdb_stats.write_sectors; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavailable"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavailable"); } } @@ -198,7 +188,6 @@ static void BlockDevice_sdc_ioStatsMeter_setValues(Meter* this, char* buffer, in char block_device[80]; static double old = 0.; static double now = 0.; - static int flash = 0; static unsigned long sec_size = 0; FILE *fp; @@ -253,11 +242,7 @@ static void BlockDevice_sdc_ioStatsMeter_setValues(Meter* this, char* buffer, in Platform_BlockDevice_sdc_stats.write_sectors_comp = Platform_BlockDevice_sdc_stats.write_sectors; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavailable"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavailable"); } } @@ -284,7 +269,6 @@ static void BlockDevice_sdd_ioStatsMeter_setValues(Meter* this, char* buffer, in char block_device[80]; static double old = 0.; static double now = 0.; - static int flash = 0; static unsigned long sec_size = 0; FILE *fp; @@ -339,11 +323,7 @@ static void BlockDevice_sdd_ioStatsMeter_setValues(Meter* this, char* buffer, in Platform_BlockDevice_sdd_stats.write_sectors_comp = Platform_BlockDevice_sdd_stats.write_sectors; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavailable"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavailable"); } } @@ -370,7 +350,6 @@ static void BlockDevice_mmcblk0_ioStatsMeter_setValues(Meter* this, char* buffer char block_device[80]; static double old = 0.; static double now = 0.; - static int flash = 0; static unsigned long sec_size = 0; FILE *fp; @@ -425,11 +404,7 @@ static void BlockDevice_mmcblk0_ioStatsMeter_setValues(Meter* this, char* buffer Platform_BlockDevice_mmcblk0_stats.write_sectors_comp = Platform_BlockDevice_mmcblk0_stats.write_sectors; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavailable"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavailable"); } } @@ -456,7 +431,6 @@ static void BlockDevice_mmcblk1_ioStatsMeter_setValues(Meter* this, char* buffer char block_device[80]; static double old = 0.; static double now = 0.; - static int flash = 0; static unsigned long sec_size = 0; FILE *fp; @@ -511,11 +485,7 @@ static void BlockDevice_mmcblk1_ioStatsMeter_setValues(Meter* this, char* buffer Platform_BlockDevice_mmcblk1_stats.write_sectors_comp = Platform_BlockDevice_mmcblk1_stats.write_sectors; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavailable"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavailable"); } } @@ -542,7 +512,6 @@ static void BlockDevice_mmcblk2_ioStatsMeter_setValues(Meter* this, char* buffer char block_device[80]; static double old = 0.; static double now = 0.; - static int flash = 0; static unsigned long sec_size = 0; FILE *fp; @@ -597,11 +566,7 @@ static void BlockDevice_mmcblk2_ioStatsMeter_setValues(Meter* this, char* buffer Platform_BlockDevice_mmcblk2_stats.write_sectors_comp = Platform_BlockDevice_mmcblk2_stats.write_sectors; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavailable"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavailable"); } } @@ -628,7 +593,6 @@ static void BlockDevice_mmcblk3_ioStatsMeter_setValues(Meter* this, char* buffer char block_device[80]; static double old = 0.; static double now = 0.; - static int flash = 0; static unsigned long sec_size = 0; FILE *fp; @@ -683,11 +647,7 @@ static void BlockDevice_mmcblk3_ioStatsMeter_setValues(Meter* this, char* buffer Platform_BlockDevice_mmcblk3_stats.write_sectors_comp = Platform_BlockDevice_mmcblk3_stats.write_sectors; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavailable"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavailable"); } } diff --git a/CpuFreqMeter.c b/CpuFreqMeter.c index 6508180..a2f39eb 100644 --- a/CpuFreqMeter.c +++ b/CpuFreqMeter.c @@ -23,7 +23,6 @@ static void CpuFreqMeter_setValues(Meter* this, char* buffer, int len) { char buf_b[32]; char buf_l[32]; int ln = sizeof(buf_l); - static int pulse = 0; memset(buf_l, 0, sizeof(buf_l)); memset(buf_b, 0, sizeof(buf_b)); @@ -66,11 +65,7 @@ static void CpuFreqMeter_setValues(Meter* this, char* buffer, int len) { xSnprintf(buf_l, ln, "%4d MHz", Freq); } - if (pulse) - xSnprintf(buffer, len, "%s %s (big.LITTLE)", buf_b, buf_l, pulse); - else - xSnprintf(buffer, len, "%s %s ", buf_b, buf_l, pulse); - pulse = !pulse; + xSnprintf(buffer, len, "%s %s (big.LITTLE)", buf_b, buf_l); return; } @@ -89,7 +84,6 @@ static void CpuFreqMeter_setValues(Meter* this, char* buffer, int len) { } else { xSnprintf(buffer, len, "%4d MHz", Freq); } - pulse = !pulse; } MeterClass CpuFreqMeter_class = { diff --git a/Eth0_Meter.c b/Eth0_Meter.c index 90e512a..21e4b05 100644 --- a/Eth0_Meter.c +++ b/Eth0_Meter.c @@ -35,11 +35,10 @@ static void Eth0_Meter_setValues(Meter* this, char* buffer, int len) { ret = findIP_interface("eth0", szIP, sizeof(szIP)); } - if (ret) { - xSnprintf(buffer, len, "%s", szIP); - } else { - xSnprintf(buffer, len, "%s", "down"); + if (!ret) { + snprintf(szIP, sizeof(szIP), "%s", "down"); } + xSnprintf(buffer, len, "%s", szIP); } MeterClass Eth0_Meter_class = { diff --git a/Eth0_StatsMeter.c b/Eth0_StatsMeter.c index 974c656..1a42334 100644 --- a/Eth0_StatsMeter.c +++ b/Eth0_StatsMeter.c @@ -27,7 +27,6 @@ static void Eth0_StatsMeter_setValues(Meter* this, char* buffer, int len) { double refreshdelay; static double old = 0.; static double now = 0.; - static int flash = 0; now = get_wall_time(); refreshdelay = now - old; @@ -57,11 +56,7 @@ static void Eth0_StatsMeter_setValues(Meter* this, char* buffer, int len) { Platform_Eth0_stats.tx_bytes_comp = Platform_Eth0_stats.tx_bytes; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavail"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavail"); } } diff --git a/Eth1_Meter.c b/Eth1_Meter.c index 41cfa05..181370f 100644 --- a/Eth1_Meter.c +++ b/Eth1_Meter.c @@ -35,11 +35,10 @@ static void Eth1_Meter_setValues(Meter* this, char* buffer, int len) { ret = findIP_interface("eth1", szIP, sizeof(szIP)); } - if (ret) { - xSnprintf(buffer, len, "%s", szIP); - } else { - xSnprintf(buffer, len, "%s", "down"); + if (!ret) { + snprintf(szIP, sizeof(szIP), "%s", "down"); } + xSnprintf(buffer, len, "%s", szIP); } MeterClass Eth1_Meter_class = { diff --git a/Eth1_StatsMeter.c b/Eth1_StatsMeter.c index 85e6dc9..e7c5718 100644 --- a/Eth1_StatsMeter.c +++ b/Eth1_StatsMeter.c @@ -27,7 +27,6 @@ static void Eth1_StatsMeter_setValues(Meter* this, char* buffer, int len) { double refreshdelay; static double old = 0.; static double now = 0.; - static int flash = 0; now = get_wall_time(); refreshdelay = now - old; @@ -57,11 +56,7 @@ static void Eth1_StatsMeter_setValues(Meter* this, char* buffer, int len) { Platform_Eth1_stats.tx_bytes_comp = Platform_Eth1_stats.tx_bytes; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavail"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavail"); } } diff --git a/Wlan0_Meter.c b/Wlan0_Meter.c index bf75623..8296a6c 100644 --- a/Wlan0_Meter.c +++ b/Wlan0_Meter.c @@ -33,11 +33,10 @@ static void Wlan0_Meter_setValues(Meter* this, char* buffer, int len) { ret = findIP_interface("wlan0", szIP, sizeof(szIP)); } - if (ret) { - xSnprintf(buffer, len, "%s", szIP); - } else { - xSnprintf(buffer, len, "%s", "down"); + if (!ret) { + snprintf(szIP, sizeof(szIP), "%s", "down"); } + xSnprintf(buffer, len, "%s", szIP); } MeterClass Wlan0_Meter_class = { diff --git a/Wlan0_StatsMeter.c b/Wlan0_StatsMeter.c index f920f9c..9ced108 100644 --- a/Wlan0_StatsMeter.c +++ b/Wlan0_StatsMeter.c @@ -27,7 +27,6 @@ static void Wlan0_StatsMeter_setValues(Meter* this, char* buffer, int len) { double refreshdelay; static double old = 0.; static double now = 0.; - static int flash = 0; now = get_wall_time(); refreshdelay = now - old; @@ -57,11 +56,7 @@ static void Wlan0_StatsMeter_setValues(Meter* this, char* buffer, int len) { Platform_Wlan0_stats.tx_bytes_comp = Platform_Wlan0_stats.tx_bytes; } else { - if (!(flash % 2)) - xSnprintf(buffer, len, "%s", "unavail"); - else - xSnprintf(buffer, len, "%s", ""); - flash++; + xSnprintf(buffer, len, "%s", "unavail"); } } diff --git a/Wlan1_Meter.c b/Wlan1_Meter.c index c5acd69..4c5fcea 100644 --- a/Wlan1_Meter.c +++ b/Wlan1_Meter.c @@ -35,11 +35,10 @@ static void Wlan1_Meter_setValues(Meter* this, char* buffer, int len) { ret = findIP_interface("wlan1", szIP, sizeof(szIP)); } - if (ret) { - xSnprintf(buffer, len, "%s", szIP); - } else { - xSnprintf(buffer, len, "%s", "down"); + if (!ret) { + snprintf(szIP, sizeof(szIP), "%s", "down"); } + xSnprintf(buffer, len, "%s", szIP); } MeterClass Wlan1_Meter_class = {