Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hardware/rpiInfo/rpiInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -225,4 +225,4 @@ uint8_t get_cpu_message(void)
syCpu = atoi(syCpubuff);
return usCpu+syCpu;

}
}
4 changes: 3 additions & 1 deletion hardware/st7735/st7735.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,15 @@ 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};
lcd_fill_screen(ST7735_BLACK);
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);
Expand All @@ -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);
Expand Down