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

Use root partition for Disk Usage calculation #17

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
41 changes: 38 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,58 @@ sudo reboot
```
**Wait for the system to restart**

## Clone SKU_RM0004 library
<br>

## Pre-Requisites
### Ubuntu
Install necessary dependencies to compile the project:
```bash
sudo apt install make gcc
```
### Home Assistant
```bash
$ apk add make gcc musl-dev i2c-tools i2c-tools-dev linux-headers
```

## Building
### Clone SKU_RM0004 library
```bash
git clone https://github.com/UCTRONICS/SKU_RM0004.git
```
## Compile
### Compile
```bash
cd SKU_RM0004
make
```
## Run
### Run
```
./display
```

## Installing

### Ubuntu
1. Create file `/etc/systemd/system/rpi-display.service`
```
[Unit]
After=network.target

[Service]
ExecStart=/home/user/git/SKU_RM0004/display

[Install]
WantedBy=default.target
```
1. Create folder (if it doesn't exist):
```
$ mkdir /etc/systemd/system/default.target.wants
```
1. Create soft link to service file:
```
$ ln -s /etc/systemd/system/rpi-display.service /etc/systemd/system/default.target.wants/default.target.wants
```

### Others
## Add automatic start script
**Open the rc.local file**
```bash
Expand Down
8 changes: 4 additions & 4 deletions hardware/rpiInfo/rpiInfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,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 @@ -135,11 +135,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 @@ -185,4 +185,4 @@ uint8_t get_cpu_message(void)
syCpu = atoi(syCpubuff);
return usCpu+syCpu;

}
}