-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from pando85/main
Improve documentation format and install instructions
- Loading branch information
Showing
9 changed files
with
466 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Changelog | ||
|
||
## 1.0.191 | ||
|
||
* Tested in CZ-TAW1B | ||
* Kernel updated | ||
|
||
## 1.0.166 | ||
|
||
* Add new topics | ||
|
||
## 1.0.159 | ||
|
||
* Removed a2wmain watch | ||
* Start ssh and www from script | ||
* Home Assistant MQTT Discovery https://www.home-assistant.io/docs/mqtt/discovery/ | ||
|
||
## 1.0.150 | ||
|
||
* Moved buttons handling from GoHeishaMon to separate script ( in this way , if GoHeishaMon will | ||
crash it is still possible to go back to orginal via 3 buttons) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# GPIO | ||
|
||
| Pin Number | Direction (Input/Output) | Function/Usage | | ||
| ---------- | ------------------------ | ---------------- | | ||
| 0 | Input | Reset Button | | ||
| 1 | Input | WPS Button | | ||
| 2 | Output | Blue Mid LED | | ||
| 3 | Output | Green Bottom LED | | ||
| 13 | Output | Green Mid LED | | ||
| 15 | Output | Red Mid LED | | ||
| 16 | Input | Check Button | | ||
|
||
## LEDs | ||
|
||
### white | ||
|
||
```bash | ||
echo high > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
``` | ||
|
||
### blue | ||
|
||
```bash | ||
echo high > /sys/class/gpio/gpio2/direction | ||
echo low > /sys/class/gpio/gpio13/direction | ||
echo low > /sys/class/gpio/gpio15/direction | ||
``` | ||
|
||
### green | ||
|
||
```bash | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo low > /sys/class/gpio/gpio15/direction | ||
``` | ||
|
||
### red | ||
|
||
```bash | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo low > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
``` | ||
|
||
### off | ||
|
||
```bash | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo low > /sys/class/gpio/gpio13/direction | ||
echo low > /sys/class/gpio/gpio15/direction | ||
``` | ||
|
||
### yellow | ||
|
||
```bash | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
``` | ||
|
||
### purple | ||
|
||
```bash | ||
echo high > /sys/class/gpio/gpio2/direction | ||
echo low > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
``` | ||
|
||
### blue bright | ||
|
||
```bash | ||
echo high > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo low > /sys/class/gpio/gpio15/direction | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
#!/bin/sh | ||
logger "the button was ${BUTTON} and the action was ${ACTION}" | ||
|
||
for dir in /var/run/hostapd-*; do | ||
[ -d "$dir" ] || continue | ||
hostapd_cli -p "$dir" wps_pbc | ||
done | ||
[ "${ACTION}" = "released" ] || exit 0 | ||
|
||
. /lib/functions.sh | ||
|
||
logger "$BUTTON pressed for $SEEN seconds" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
# Put your custom commands here that should be executed once | ||
# the system init finished. By default this file does nothing. | ||
|
||
echo "START WATCHDOG =====" > /dev/ttyS0 | ||
logger "Start watchdog" | ||
echo 300 > /proc/sys/kernel/panic | ||
echo 0 > /proc/sys/kernel/panic_on_oops | ||
|
||
(/usr/bin/check_buttons.sh > /dev/null 2>&1) & | ||
|
||
logger -t rc.local "Execute nextboot.sh" | ||
/etc/gh/nextboot.sh | ||
|
||
logger -t rc.local "Clean nextboot.sh" | ||
echo "" > /etc/gh/nextboot.sh | ||
echo "START GoHeishaMon APL=====" > /dev/ttyS0 | ||
|
||
logger -t rc.local "Start GoHeishaMon" | ||
/usr/bin/GoHeishaMon_MIPSUPX > /dev/ttyS0 | ||
|
||
#/usr/bin/a2wmain > /dev/ttyS0 | ||
#exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,75 @@ | ||
#!/bin/ash | ||
|
||
#LED | ||
GOHEISHAMON_BIN=/usr/bin/GoHeishaMon_MIPSUPX | ||
|
||
logger -t check_buttons.sh "Init GPIOs" | ||
|
||
# LED | ||
echo 2 > /sys/class/gpio/export | ||
echo 3 > /sys/class/gpio/export | ||
echo 13 > /sys/class/gpio/export | ||
echo 15 > /sys/class/gpio/export | ||
|
||
#link | ||
# link | ||
echo 10 > /sys/class/gpio/export | ||
|
||
#buttons | ||
# buttons | ||
echo 0 > /sys/class/gpio/export | ||
echo 1 > /sys/class/gpio/export | ||
echo 16 > /sys/class/gpio/export | ||
|
||
while true; do | ||
# press == `hi` | ||
ButtonReset=`awk '/gpio-0 /{print $5}' /sys/kernel/debug/gpio` | ||
# press == `hi` | ||
ButtonWPS=`awk '/gpio-1 /{print $5}' /sys/kernel/debug/gpio` | ||
# press == `lo` | ||
ButtonCheck=`awk '/gpio-16 /{print $5}' /sys/kernel/debug/gpio` | ||
# Pin for communication by serial port | ||
CNCNTLink=`awk '/gpio-10 /{print $5}' /sys/kernel/debug/gpio` | ||
|
||
while : | ||
do | ||
|
||
ButtonReset=`awk '/gpio-0 /{print $5}' /sys/kernel/debug/gpio` | ||
ButtonWPS=`awk '/gpio-1 /{print $5}' /sys/kernel/debug/gpio` | ||
ButtonCheck=`awk '/gpio-16 /{print $5}' /sys/kernel/debug/gpio` | ||
CNCNTLink=`awk '/gpio-10 /{print $5}' /sys/kernel/debug/gpio` | ||
|
||
#bwhite | ||
if [ "$ButtonReset" = 'lo' ] && [ "$ButtonWPS" = 'lo' ] && [ "$ButtonCheck" = 'hi' ] ; then | ||
echo high > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
fi | ||
|
||
#blue | ||
if [ "$ButtonReset" = 'hi' ] || [ "$ButtonWPS" = 'hi' ] || [ "$ButtonCheck" = 'lo' ] ; then | ||
echo high > /sys/class/gpio/gpio2/direction | ||
echo low > /sys/class/gpio/gpio13/direction | ||
echo low > /sys/class/gpio/gpio15/direction | ||
fi | ||
|
||
#yellow | ||
if [ "$ButtonReset" = 'hi' ] && [ "$ButtonWPS" = 'hi' ] ; then | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
fi | ||
if [ "$ButtonReset" = 'hi' ] && [ "$ButtonCheck" = 'lo' ] ;then | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
fi | ||
if [ "$ButtonWPS" = 'hi' ] && [ "$ButtonCheck" = 'lo' ] ; then | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
fi | ||
# GoHeishaMon running | ||
if [ $(ps | grep "$GOHEISHAMON_BIN" | wc -l) -gt 1 ]; then | ||
# white LED | ||
echo high > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
else | ||
# off LED | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo low > /sys/class/gpio/gpio13/direction | ||
echo low > /sys/class/gpio/gpio15/direction | ||
fi | ||
|
||
#fw side switch | ||
if [ "$ButtonReset" = 'hi' ] && [ "$ButtonWPS" = 'hi' ] && [ "$ButtonCheck" = 'lo' ] ; then | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo low > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
fwupdate sw > /dev/null 2>&1 | ||
sync | ||
reboot | ||
fi | ||
if [ "$ButtonReset" = 'hi' ] && [ "$ButtonWPS" = 'lo' ] && [ "$ButtonCheck" = 'hi' ] ; then | ||
# yellow LED | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo high > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
logger -t check_buttons.sh "Restart GoHeishaMon" | ||
kill $(ps | grep "$GOHEISHAMON_BIN" | head -n1 | awk '{ print $1 }') | ||
$GOHEISHAMON_BIN > /dev/ttyS0 & | ||
fi | ||
|
||
if [ "$CNCNTLink" = 'hi' ] ; then | ||
echo low > /sys/class/gpio/gpio3/direction | ||
fi | ||
if [ "$CNCNTLink" = 'lo' ] ; then | ||
echo high > /sys/class/gpio/gpio3/direction | ||
fi | ||
# fw side switch | ||
if [ "$ButtonReset" = 'hi' ] && [ "$ButtonWPS" = 'hi' ] && [ "$ButtonCheck" = 'lo' ] ; then | ||
# red LED | ||
echo low > /sys/class/gpio/gpio2/direction | ||
echo low > /sys/class/gpio/gpio13/direction | ||
echo high > /sys/class/gpio/gpio15/direction | ||
fwupdate sw > /dev/null 2>&1 | ||
sync | ||
reboot | ||
fi | ||
|
||
sleep 1 | ||
if [ "$CNCNTLink" = 'hi' ] ; then | ||
echo low > /sys/class/gpio/gpio3/direction | ||
fi | ||
if [ "$CNCNTLink" = 'lo' ] ; then | ||
echo high > /sys/class/gpio/gpio3/direction | ||
fi | ||
|
||
sleep 1 | ||
done | ||
|
||
exit 0 |
Oops, something went wrong.