Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Disks and Custom Info #25

Open
ILL-DIE-TRYING opened this issue Nov 23, 2021 · 0 comments
Open

Multiple Disks and Custom Info #25

ILL-DIE-TRYING opened this issue Nov 23, 2021 · 0 comments

Comments

@ILL-DIE-TRYING
Copy link

I don't know C very well but have enough scripting experience to see what is basically happening.

I have multiple disks. I just copied the sd card diskspace function in ssd1306_i2c.c,
I renamed it LCD_DisplayVarMemory, and changed the target to /var.

/VAR Drive Block Of Code

void LCD_DisplayVarMemory(void)
{
char usedsize_GB[10]={0};
char totalsize_GB[10]={0};
unsigned int MemSize=0;
unsigned int size=0;
struct statfs diskInfo;
statfs("/var",&diskInfo);
OLED_ClearLint(2,4);
OLED_DrawPartBMP(0,2,128,4,BMP,2);
unsigned long long blocksize = diskInfo.f_bsize;// The number of bytes per block
unsigned long long totalsize = blocksize*diskInfo.f_blocks;//Total number of bytes
MemSize=(unsigned int)(totalsize>>30);
snprintf(totalsize_GB,7,"%d",MemSize);
if(MemSize>0&&MemSize<10)
{
OLED_ShowString(106,3,totalsize_GB,8);
}
else if(MemSize>=10&&MemSize<100)
{
OLED_ShowString(98,3,totalsize_GB,8);
}
else
{
OLED_ShowString(90,3,totalsize_GB,8);
}

unsigned long long freesize = blocksize*diskInfo.f_bfree; //Now let's figure out how much space we have left
size=freesize>>30;
size=MemSize-size;
snprintf(usedsize_GB,7,"%d",size);
if(size>0&&size<10)
{
OLED_ShowString(65,3,usedsize_GB,8);
}
else if(size>=10&&size<100)
{
OLED_ShowString(58,3,usedsize_GB,8);
}
else
{
OLED_ShowString(55,3,usedsize_GB,8);
}
}

I also had to add a few lines to LCD_Display like so:

original code

case 2:
LCD_DisplaySdMemory();
break;

new code added after case 2 break;

case 3:
LCD_DisplayVarMemory();
break;

fixing the rotation to view the new drive info

I also had to change display.c line 29 from if(symbol==3) to if(symbol==4) for the new drive to be used in the rotation. Adding a third drive (or anything else) will have to change it to ==5

It seems to work fine, my only issue is the label for it.
The label shows a little card and says "disk"

I would like to change the label from "disk" to "var" for the var drive and I also have another drive to add that holds backups and would like that one to have the label set to "backups" or even just "BACK' or something.

For the life of me I cannot find where to set this label.
Any help with icons and labels by chance?

Anything I may have missed?

I noticed in ssd1306_i2c.h on line 36 there is "void LCD_DisplaySdMemory(void);"
Do I need to do the same for my extra drives/info? "void LCD_DisplayVarMemory(void);"

Other things I would like to add (any help would be greatly appreciated)

add hostname into the rotation
add the ubuntu release version
add kernel version
add number of packages needed updating/upgrading from apt

Thanks a bunch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant