Open main menu

Changes

X728-script

839 bytes added, 2 April
Now we think you have successfully flashed the OS Image into Micro SD and and power on the device, and you have also completed the operations such as creating new user required in some OS. You need to perform the following operations in <code>Terminal</code>.
'''[NOTE]:'''
'''[Update]:''' 1. Use '''gpiod''' instead of obsolete interface 2. The script now supports the Raspberry Pi OS '''BOOKWORM''' version. You just need to '''uninstall''' the original script and '''reinstall''' it. Please refer to the following:
OPen ternimal window, then run the following command:
Then just follow the installation process below.
23. The current installation script also supports Raspberry Pi 5 hardware.
==OS that has been tested==
#68 - the address of the RTC chip
</PRE>
 
===Install gpiod package===
sudo apt install -y gpiod
===Clone the script===
'''PS''': For some OS such as 'Raspberry Pi OS Lite', the '''git''' tool is not installed by default, if you get an error like '''error: -bash: git: command not found''', please run the following command to install the git tool.
sudo apt install -y git
 
===Configuring Different GPIO Chip for Raspberry Pi 5 hardware===
If you are not using Raspberry 5 hardware, skip this step,or run the following command to set differnt chip and pwm number.
sed -i 's/xPWR.sh 0 5 12/xPWR.sh 4 5 12/g' x728-pwr.service
sed -i 's/xSoft.sh 0 26/xSoft.sh 4 26/g' install-sss.sh
sed -i 's/xSoft.sh 0 16/xSoft.sh 4 16/g' install-sss-v1.sh
===Create the x728-pwr service===
x728-pwr service will be responsible for power management and hardware safe shutdown.
<pre>
sudo cp -f ./xPWR.sh /usr/local/bin/
sudo cp -f x728-pwr.service /lib/systemd/system
sudo systemctl daemon-reload
===Prepair software shutdown script===
* Copy xSoft.sh to /usr/local/bin/
sudo cp -f ./xSoft.sh /usr/local/bin/
 
* Create a <code>x728off</code> command to execute the software shutdown, Please check the version of X728 shield and run the different command:
 
for <code>x728-v2.x-softsd.sh</code>
echo "alias x728off='sudo /usr/local/bin/xSoft.sh 0 26'" >> ~/.bashrc
 
for <code>x728 v1.2/v1.3 shield</code>
echo "alias x728off='sudo /usr/local/bin/xSoft.sh 0 16'" >> ~/.bashrc
Only use the diffent gpio no * for software shutdownx728 v2.5 v2.3 v2.2 v2.1 v2.0 ./install-sss.sh
* Enable alias x728offfor x728 v1.2 v1.3 source ~./install-sss-v1.bashrcsh
Then you can run <code>x728off</code> to execute software shutdown as follows
===Sample Files===
The example programs are only suitable for advanced players, and you can construct your own usage scenarios according to the example programs.
 
'''[PS]'''
 
The old example code uses the RPi.GPIO library, which is currently not supported in kernel 6.6.x, so you may encounter an error when running the following code
sudo python3 sample/x728-v2.x-plsd.py
 
Note that you need to provide a different gpiochip number on Pi 0,1,2,3,4 ('''0''') and Pi 5 ('''4''').
 
We recommend that you change your example program to use the libgpiod library, and libgpiod is officially recommended, and we also provide ONLY ONE example using the libgpiod library ('''x728-v2.x-plsd-gpiod.py'''), which you can run as follows:
 
sudo python3 sample/x728-v2.x-plsd-libgpiod.py
 
For other example programs that use the RPi.GPIO library, it is recommended that you change to the libgpiod version if it runs incorrectly.
 
In fact, you can change those sample program to shell
Each example program demonstrates a different function: