From fb5d1190e820793a01bc37f1b4ef1eacdcc466ed Mon Sep 17 00:00:00 2001 From: Jorge Benjumea Date: Thu, 20 Apr 2023 19:21:58 -0700 Subject: [PATCH 1/4] Use root partition for Disk Usage calculation --- hardware/rpiInfo/rpiInfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hardware/rpiInfo/rpiInfo.c b/hardware/rpiInfo/rpiInfo.c index c1cd831..1454cfc 100644 --- a/hardware/rpiInfo/rpiInfo.c +++ b/hardware/rpiInfo/rpiInfo.c @@ -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); @@ -185,4 +185,4 @@ uint8_t get_cpu_message(void) syCpu = atoi(syCpubuff); return usCpu+syCpu; -} \ No newline at end of file +} From 89812d3533fa7bbc6d4163b33bc3fb6f6d31715c Mon Sep 17 00:00:00 2001 From: Jorge Benjumea Date: Wed, 5 Jul 2023 20:22:39 -0700 Subject: [PATCH 2/4] Use MemAvailable to calculate memory usage --- hardware/rpiInfo/rpiInfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/rpiInfo/rpiInfo.c b/hardware/rpiInfo/rpiInfo.c index 1454cfc..8241906 100644 --- a/hardware/rpiInfo/rpiInfo.c +++ b/hardware/rpiInfo/rpiInfo.c @@ -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; } From 6896ae039c2c987b8e9f3b8ca6c094b80dca5f6c Mon Sep 17 00:00:00 2001 From: Jorge Moreno Benjumea Date: Mon, 10 Jul 2023 17:18:15 -0700 Subject: [PATCH 3/4] Updated README with dependency instructions for Ubuntu --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b26df6..0886e3f 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,12 @@ sudo reboot ``` **Wait for the system to restart** -## Clone SKU_RM0004 library +## Ubuntu +Install necessary dependencies to compile the project: +```bash +sudo apt install make gcc +``` +## Clone SKU_RM0004 library ```bash git clone https://github.com/UCTRONICS/SKU_RM0004.git ``` From 7319a5aa7ed84849c6051ad1af9868f15c837754 Mon Sep 17 00:00:00 2001 From: Jorge Moreno Benjumea Date: Fri, 17 Nov 2023 19:08:24 -0800 Subject: [PATCH 4/4] Added instructions for Home Assistant OS --- README.md | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0886e3f..2afb108 100644 --- a/README.md +++ b/README.md @@ -19,28 +19,58 @@ sudo reboot ``` **Wait for the system to restart** -## Ubuntu +
+ +## Pre-Requisites +### Ubuntu Install necessary dependencies to compile the project: ```bash sudo apt install make gcc ``` -## Clone SKU_RM0004 library +### 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