diff --git a/hardware/rpiInfo/rpiInfo.c b/hardware/rpiInfo/rpiInfo.c index 5d9205f..79f8159 100644 --- a/hardware/rpiInfo/rpiInfo.c +++ b/hardware/rpiInfo/rpiInfo.c @@ -138,7 +138,7 @@ void get_cpu_memory(float *Totalram,float *freeram) { *Totalram=value/1000.0/1000.0; } - else if(strcmp(famer,"MemFree:")==0) + else if(strcmp(famer,"MemAvailable:")==0) { *freeram=value/1000.0/1000.0; } @@ -175,11 +175,11 @@ uint8_t get_hard_disk_memory(uint16_t *diskMemSize, uint16_t *useMemSize) uint8_t diskMembuff[10] = {0}; uint8_t useMembuff[10] = {0}; FILE *fd = NULL; - fd=popen("df -l | grep /dev/sda | awk '{printf \"%s\", $(2)}'","r"); + fd=popen("df -l / | grep /dev/sda | awk '{printf \"%s\", $(2)}'","r"); fgets(diskMembuff,sizeof(diskMembuff),fd); fclose(fd); - fd=popen("df -l | grep /dev/sda | awk '{printf \"%s\", $(3)}'","r"); + fd=popen("df -l / | grep /dev/sda | awk '{printf \"%s\", $(3)}'","r"); fgets(useMembuff,sizeof(useMembuff),fd); fclose(fd); @@ -225,4 +225,4 @@ uint8_t get_cpu_message(void) syCpu = atoi(syCpubuff); return usCpu+syCpu; -} \ No newline at end of file +} diff --git a/hardware/st7735/st7735.c b/hardware/st7735/st7735.c index bac95cf..ef63de9 100644 --- a/hardware/st7735/st7735.c +++ b/hardware/st7735/st7735.c @@ -276,6 +276,7 @@ void lcd_display_percentage(uint8_t val, uint16_t color) void lcd_display_cpuLoad(void) { + char hostname[1024]; char iPSource[20] = {0}; uint8_t cpuLoad = 0; uint8_t cpuStr[10] = {0}; @@ -283,6 +284,7 @@ void lcd_display_cpuLoad(void) cpuLoad = get_cpu_message(); sprintf(cpuStr, "%d", cpuLoad); lcd_fill_rectangle(0, 20, ST7735_WIDTH, 5, ST7735_BLUE); + gethostname(hostname, 1024); if (IP_SWITCH == IP_DISPLAY_OPEN) { lcd_write_string(0, 0, "IP:", Font_8x16, ST7735_WHITE, ST7735_BLACK); @@ -291,7 +293,7 @@ void lcd_display_cpuLoad(void) } else { - lcd_write_string(0, 0, CUSTOM_DISPLAY, Font_8x16, ST7735_WHITE, ST7735_BLACK); // Send the IP address to the lower machine + lcd_write_string(0, 0, hostname, Font_8x16, ST7735_WHITE, ST7735_BLACK); // Send the IP address to the lower machine } lcd_write_string(36, 35, "CPU:", Font_11x18, ST7735_WHITE, ST7735_BLACK); lcd_write_string(80, 35, cpuStr, Font_11x18, ST7735_WHITE, ST7735_BLACK);