Have you considered adding 64 line Oled support? Maybe the install script could give the option of 32 or 64 line support.
I believe the only difference is the line
cc -o oled oled.c fontx.c -lwiringPi -lpthread -DI2C -DX32
would become cc -o oled oled.c fontx.c -lwiringPi -lpthread -DI2C
We would then need a way in the other scripts to test if 32 or 64 lines are supported.
On my Backup Box I have replaced the lines
# If display support is enabled, notify that the storage device has been mounted
if [ $DISP = true ]; then
oled r
oled +a Storage OK"
.....
with the following, this way when the storage media is inserted it tells me the media size, percent used and available space on the media.
# If display support is enabled, notify that the storage device has been mounted
if [ $DISP = true ]; then
storsize=$(df /dev/sda1 -h --output=size | sed '1d')
storused=$(df /dev/sda1 -h --output=pcent | sed '1d')
storfree=$(df /dev/sda1 -h --output=avail | sed '1d')
oled r
oled +a "Storage: $storsize"
oled +b " Used: $storused"
oled +c " Free:$storfree"
oled +d "Insert Card ..."
sudo oled s
fi
Hello i have not done any work on showing percent of files copied but I have used the following code to display the number of files that are to be copied
filecount=$(rsync -avtr --progress --dry-run --stats "$CARD_MOUNT_POINT"/ "$BACKUP_PATH" | fgrep 'Number of created files' | cut -d' ' -f5 | tr -d ,)
if [ $DISP = true ]; then
oled r
oled +a "Photo card OK"
oled +b "$filecount files are"
oled +c "being copied ..."
sudo oled s
fi
That script looks great. it would be exactly what this project needs. im sorry to be a noob, but how have you managed to get the oled to work. i have it all working except for the oled display, even when i run the test script, i cannot get anything to display. once i get it working i am hoping i can implement the script you have written above.
Hi Paul
There are a number of requirements for successful Oled deployment check the following;
1.This project currently only suports I2C Oled displays, some similar displays are SPI these wonât work.
2. The Oled display must use the SSD1306 chipset.
3. When you run the install script you need to say yes to the Oled support question.
4 . Do what the install script says to do after the script completes
Run the following command sudo raspi-config
Go to the Interfacing Options section and enable I2C - the Pi does not compile I2C support into the kernal by default so this step is important to enable support for the I2C interface
Reboot
5. Also be aware that the SCA and SCL pins are not in the same order as the pins on the PI
On my pi the connections are
After a reboot it should all just work and you start to see messages. You can also goto into the Oled library sub directory and run the test script to see the display run through the various text options it supports.
I have pushed a merge request which uses an additional script to report:
%age complete (as reported by Rsync using --info=progress2)
transfer rate in Mbps (as reported by Rsync using --info=progress2)
It updates after each file is transferred. The code which parses the rsync output also has the filename and file count so they could also be output on a 4 line Oled.
Yes Iâm all for keeping people informed as best as possible about the current state of the apps progress. I think unless there is a narrower font available that message lines can only be 16 characters long with the current oled library. You have done some good work there Simon!
Just had a thought about how we could probably add a progress bar without using a graphics library. The oled +R command turns on reverse text but only for any text characters on a line including spaces, so if we get the percent of the rysync job that is completed and divide it by 6.25 that would be the number of spaces we write to the reverse highlighted line. This would produce a course update bar and after 3 spaces are full we could also start writing the xx% figure inside the bar, OK that means no text until at least 20% but without going the full graphic option itâs the best that can be achieved.
Playing with the Contact Sheet generation yesterday, I noticed that the oled command doesnât throw errors if thereâs no screen on the I2C bus. (Presumably the board has pull up resistors to stop people burning the CPU out writing to a null buss).
Could the script be simplified by removing the if statements?
This would add about 0.1s to the script execution time if my testing is correct.