mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Merge branch 'jayofelony:master' into master
This commit is contained in:
101
bin/pwnagotchi
101
bin/pwnagotchi
@ -7,6 +7,7 @@ import sys
|
|||||||
import toml
|
import toml
|
||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
import pwnagotchi
|
import pwnagotchi
|
||||||
from pwnagotchi import utils
|
from pwnagotchi import utils
|
||||||
@ -133,6 +134,8 @@ if __name__ == '__main__':
|
|||||||
help="Print the configuration.")
|
help="Print the configuration.")
|
||||||
|
|
||||||
# Jayofelony added these
|
# Jayofelony added these
|
||||||
|
parser.add_argument('--wizard', dest="wizard", action="store_true", default=False,
|
||||||
|
help="Interactive installation of your personal configuration.")
|
||||||
parser.add_argument('--check-update', dest="check_update", action="store_true", default=False,
|
parser.add_argument('--check-update', dest="check_update", action="store_true", default=False,
|
||||||
help="Check for updates on Pwnagotchi. And tells current version.")
|
help="Check for updates on Pwnagotchi. And tells current version.")
|
||||||
parser.add_argument('--donate', dest="donate", action="store_true", default=False,
|
parser.add_argument('--donate', dest="donate", action="store_true", default=False,
|
||||||
@ -157,6 +160,102 @@ if __name__ == '__main__':
|
|||||||
print(pwnagotchi.__version__)
|
print(pwnagotchi.__version__)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
if args.wizard:
|
||||||
|
def is_valid_hostname(hostname):
|
||||||
|
if len(hostname) > 255:
|
||||||
|
return False
|
||||||
|
if hostname[-1] == ".":
|
||||||
|
hostname = hostname[:-1] # strip exactly one dot from the right, if present
|
||||||
|
allowed = re.compile("(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)
|
||||||
|
return all(allowed.match(x) for x in hostname.split("."))
|
||||||
|
|
||||||
|
pwn_restore = input("Do you want to restore the previous configuration? [Y/N]\n")
|
||||||
|
if pwn_restore in ('y', 'yes'):
|
||||||
|
os.system("cp -f /etc/pwnagotchi/config.toml.bak /etc/pwnagotchi/config.toml")
|
||||||
|
print("Your previous configuration is restored, and I will restart in 5 seconds.")
|
||||||
|
time.sleep(5)
|
||||||
|
os.system("service pwnagotchi restart")
|
||||||
|
else:
|
||||||
|
pwn_check = input("This will create a new configuration file and overwrite your current backup, are you sure? [Y/N]\n")
|
||||||
|
if pwn_check.lower() in ('y', 'yes'):
|
||||||
|
os.system("mv -f /etc/pwnagotchi/config.toml /etc/pwnagotchi/config.toml.bak")
|
||||||
|
with open("/etc/pwnagotchi/config.toml", "a+") as f:
|
||||||
|
f.write("# Do not edit this file if you do not know what you are doing!!!\n\n")
|
||||||
|
# Set pwnagotchi name
|
||||||
|
print("Welcome to the interactive installation of your personal Pwnagotchi configuration!\n"
|
||||||
|
"My name is Jayofelony, how may I call you?\n")
|
||||||
|
pwn_name = input("Pwnagotchi name (no spaces): ")
|
||||||
|
if pwn_name == "":
|
||||||
|
pwn_name = "Pwnagotchi"
|
||||||
|
print("I shall go by Pwnagotchi from now on!")
|
||||||
|
pwn_name = f"main.name = \"{pwn_name}\"\n"
|
||||||
|
f.write(pwn_name)
|
||||||
|
else:
|
||||||
|
if is_valid_hostname(pwn_name):
|
||||||
|
print(f"I shall go by {pwn_name} from now on!")
|
||||||
|
pwn_name = f"main.name = \"{pwn_name}\"\n"
|
||||||
|
f.write(pwn_name)
|
||||||
|
else:
|
||||||
|
print("You have chosen an invalid name. Please start over.")
|
||||||
|
exit()
|
||||||
|
pwn_whitelist = input("How many networks do you want to whitelist? "
|
||||||
|
"We will also ask a MAC for each network?\n"
|
||||||
|
"Each SSID and BSSID count as 1 network. \n\n"
|
||||||
|
"Be sure to use digits as your answer.\n\n"
|
||||||
|
"Amount of networks: ")
|
||||||
|
if int(pwn_whitelist) > 0:
|
||||||
|
f.write("main.whitelist = [\n")
|
||||||
|
for x in range(int(pwn_whitelist)):
|
||||||
|
ssid = input("SSID (Name): ")
|
||||||
|
bssid = input("BSSID (MAC): ")
|
||||||
|
f.write(f"\t\"{ssid}\",\n")
|
||||||
|
f.write(f"\t\"{bssid}\",\n")
|
||||||
|
f.write("]\n")
|
||||||
|
# set bluetooth tether
|
||||||
|
pwn_bluetooth = input("Do you want to enable BT-Tether? [Y/N] ")
|
||||||
|
if pwn_bluetooth.lower() in ('y', 'yes'):
|
||||||
|
f.write("main.plugins.bt-tether.enabled = true\n\n")
|
||||||
|
pwn_bluetooth_device = input("What device do you use? Android or iOS? ")
|
||||||
|
if pwn_bluetooth_device.lower() == "android":
|
||||||
|
f.write("main.plugins.bt-tether.devices.android-phone.enabled = true\n")
|
||||||
|
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device? ")
|
||||||
|
if pwn_bluetooth_mac != "":
|
||||||
|
f.write(f"main.plugins.bt-tether.devices.android-phone.mac = \"{pwn_bluetooth_mac}\"\n")
|
||||||
|
elif pwn_bluetooth_device.lower() == "ios":
|
||||||
|
f.write("main.plugins.bt-tether.devices.ios-phone.enabled = true\n")
|
||||||
|
pwn_bluetooth_mac = input("What is the bluetooth MAC of your device? ")
|
||||||
|
if pwn_bluetooth_mac != "":
|
||||||
|
f.write(f"main.plugins.bt-tether.devices.ios-phone.mac = \"{pwn_bluetooth_mac}\"\n")
|
||||||
|
# set up display settings
|
||||||
|
pwn_display_enabled = input("Do you use a display? [Y/N] ")
|
||||||
|
if pwn_display_enabled.lower() in ('y', 'yes'):
|
||||||
|
f.write("ui.display.enabled = true\n")
|
||||||
|
pwn_display_type = input("What display do you use?\n\n"
|
||||||
|
"Be sure to check for the correct display type @ \n"
|
||||||
|
"https://github.com/jayofelony/pwnagotchi/blob/master/pwnagotchi/utils.py#L240-L431\n")
|
||||||
|
if pwn_display_type != "":
|
||||||
|
f.write(f"ui.display.type = \"{pwn_display_type}\"\n")
|
||||||
|
pwn_display_invert = input("Do you want to invert the display colors? [Y/N]\n\n"
|
||||||
|
"N = Black background\n"
|
||||||
|
"Y = White background\n")
|
||||||
|
if pwn_display_invert.lower() in ('y', 'yes'):
|
||||||
|
f.write("ui.invert = true\n")
|
||||||
|
f.close()
|
||||||
|
if pwn_bluetooth.lower() in ('y', 'yes'):
|
||||||
|
if pwn_bluetooth_device.lower == "android":
|
||||||
|
print("To visit the webui when connected with your phone, visit: http://192.168.44.44:8080\n"
|
||||||
|
"Your configuration is done, and I will restart in 5 seconds.")
|
||||||
|
elif pwn_bluetooth_device.lower == "ios":
|
||||||
|
print("To visit the webui when connected with your phone, visit: http://172.20.10.6:8080\n"
|
||||||
|
"Your configuration is done, and I will restart in 5 seconds.")
|
||||||
|
else:
|
||||||
|
print("Your configuration is done, and I will restart in 5 seconds.")
|
||||||
|
time.sleep(5)
|
||||||
|
os.system("service pwnagotchi restart")
|
||||||
|
else:
|
||||||
|
print("Ok, doing nothing.")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
if args.donate:
|
if args.donate:
|
||||||
print("Donations can made @ \n "
|
print("Donations can made @ \n "
|
||||||
"https://www.patreon.com/pwnagotchi_torch \n "
|
"https://www.patreon.com/pwnagotchi_torch \n "
|
||||||
@ -172,7 +271,7 @@ if __name__ == '__main__':
|
|||||||
local = version_to_tuple(pwnagotchi.__version__)
|
local = version_to_tuple(pwnagotchi.__version__)
|
||||||
remote = version_to_tuple(latest_ver)
|
remote = version_to_tuple(latest_ver)
|
||||||
if remote > local:
|
if remote > local:
|
||||||
user_input = input("There is a new version available! Update from v%s to v%s?\n[y(es)/n(o)]"
|
user_input = input("There is a new version available! Update from v%s to v%s?\n[Y/N] "
|
||||||
% (pwnagotchi.__version__, latest_ver))
|
% (pwnagotchi.__version__, latest_ver))
|
||||||
# input validation
|
# input validation
|
||||||
if user_input.lower() in ('y', 'yes'):
|
if user_input.lower() in ('y', 'yes'):
|
||||||
|
@ -383,6 +383,11 @@
|
|||||||
block: |
|
block: |
|
||||||
export GOPATH=$HOME/go
|
export GOPATH=$HOME/go
|
||||||
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
|
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
|
||||||
|
alias custom='cd /usr/local/share/pwnagotchi/custom-plugins/'
|
||||||
|
alias config='sudo nano /etc/pwnagotchi/config.toml'
|
||||||
|
alias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'
|
||||||
|
alias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'
|
||||||
|
alias pwnkill='sudo killall -USR1 pwnagotchi'
|
||||||
when: golang.changed
|
when: golang.changed
|
||||||
|
|
||||||
- name: download pwngrid
|
- name: download pwngrid
|
||||||
@ -451,7 +456,7 @@
|
|||||||
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
|
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
|
||||||
# Example:
|
# Example:
|
||||||
# ui.display.enabled = true
|
# ui.display.enabled = true
|
||||||
# ui.display.type = "waveshare_2"
|
# ui.display.type = "waveshare_4"
|
||||||
when: not user_config.stat.exists
|
when: not user_config.stat.exists
|
||||||
|
|
||||||
- name: Delete motd 10-uname
|
- name: Delete motd 10-uname
|
||||||
@ -494,24 +499,6 @@
|
|||||||
regexp: '(.*)$'
|
regexp: '(.*)$'
|
||||||
line: '\1 modules-load=dwc2,g_ether'
|
line: '\1 modules-load=dwc2,g_ether'
|
||||||
|
|
||||||
- name: Add pwnlog alias
|
|
||||||
lineinfile:
|
|
||||||
dest: /home/pi/.bashrc
|
|
||||||
line: "\nalias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'"
|
|
||||||
insertafter: EOF
|
|
||||||
|
|
||||||
- name: Add pwnver alias
|
|
||||||
lineinfile:
|
|
||||||
dest: /home/pi/.bashrc
|
|
||||||
line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'"
|
|
||||||
insertafter: EOF
|
|
||||||
|
|
||||||
- name: Add pwnkill alias to restart pwnagotchi with a signal
|
|
||||||
lineinfile:
|
|
||||||
dest: /home/pi/.bashrc
|
|
||||||
line: "\nalias pwnkill='sudo killall -USR1 pwnagotchi'"
|
|
||||||
insertafter: EOF
|
|
||||||
|
|
||||||
- name: add firmware packages to hold
|
- name: add firmware packages to hold
|
||||||
dpkg_selections:
|
dpkg_selections:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
|
@ -2,7 +2,7 @@ _show_complete()
|
|||||||
{
|
{
|
||||||
local cur opts node_names all_options opt_line
|
local cur opts node_names all_options opt_line
|
||||||
all_options="
|
all_options="
|
||||||
pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --check-update --donate {plugins,google}
|
pwnagotchi -h --help -C --config -U --user-config --manual --skip-session --clear --debug --version --print-config --wizard --check-update --donate {plugins,google}
|
||||||
pwnagotchi plugins -h --help {list,install,enable,disable,uninstall,update,upgrade}
|
pwnagotchi plugins -h --help {list,install,enable,disable,uninstall,update,upgrade}
|
||||||
pwnagotchi plugins list -i --installed -h --help
|
pwnagotchi plugins list -i --installed -h --help
|
||||||
pwnagotchi plugins install -h --help
|
pwnagotchi plugins install -h --help
|
||||||
|
@ -20,6 +20,7 @@ echo " I'm managed by systemd. Here are some basic commands."
|
|||||||
echo
|
echo
|
||||||
echo " If you want to know what I'm doing, you can check my logs with the command"
|
echo " If you want to know what I'm doing, you can check my logs with the command"
|
||||||
echo " - pwnlog"
|
echo " - pwnlog"
|
||||||
|
echo " - sudo pwnagotchi --wizard, to help set up a config.toml"
|
||||||
echo " - sudo pwnagotchi --version, to check the current version"
|
echo " - sudo pwnagotchi --version, to check the current version"
|
||||||
echo " - sudo pwnagotchi --donate, to see how you can donate to this project"
|
echo " - sudo pwnagotchi --donate, to see how you can donate to this project"
|
||||||
echo " - sudo pwnagotchi --check-update, to see if there is a new version available"
|
echo " - sudo pwnagotchi --check-update, to see if there is a new version available"
|
||||||
|
@ -497,6 +497,11 @@
|
|||||||
block: |
|
block: |
|
||||||
export GOPATH=$HOME/go
|
export GOPATH=$HOME/go
|
||||||
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
|
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
|
||||||
|
alias custom='cd /usr/local/share/pwnagotchi/custom-plugins/'
|
||||||
|
alias config='sudo nano /etc/pwnagotchi/config.toml'
|
||||||
|
alias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'
|
||||||
|
alias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'
|
||||||
|
alias pwnkill='sudo killall -USR1 pwnagotchi'
|
||||||
when: golang.changed
|
when: golang.changed
|
||||||
|
|
||||||
- name: download pwngrid
|
- name: download pwngrid
|
||||||
@ -585,7 +590,7 @@
|
|||||||
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
|
# Add your configuration overrides on this file any configuration changes done to default.toml will be lost!
|
||||||
# Example:
|
# Example:
|
||||||
# ui.display.enabled = true
|
# ui.display.enabled = true
|
||||||
# ui.display.type = "waveshare_2"
|
# ui.display.type = "waveshare_4"
|
||||||
when: not user_config.stat.exists
|
when: not user_config.stat.exists
|
||||||
|
|
||||||
- name: Delete motd
|
- name: Delete motd
|
||||||
@ -598,24 +603,6 @@
|
|||||||
state: absent
|
state: absent
|
||||||
path: /etc/update-motd.d/10-uname
|
path: /etc/update-motd.d/10-uname
|
||||||
|
|
||||||
- name: Add pwnlog alias
|
|
||||||
lineinfile:
|
|
||||||
dest: /home/pi/.bashrc
|
|
||||||
line: "\nalias pwnlog='tail -f -n300 /etc/pwnagotchi/log/pwn*.log | sed --unbuffered \"s/,[[:digit:]]\\{3\\}\\]//g\" | cut -d \" \" -f 2-'"
|
|
||||||
insertafter: EOF
|
|
||||||
|
|
||||||
- name: Add pwnver alias
|
|
||||||
lineinfile:
|
|
||||||
dest: /home/pi/.bashrc
|
|
||||||
line: "\nalias pwnver='python3 -c \"import pwnagotchi as p; print(p.__version__)\"'"
|
|
||||||
insertafter: EOF
|
|
||||||
|
|
||||||
- name: Add pwnkill alias to restart pwnagotchi with a signal
|
|
||||||
lineinfile:
|
|
||||||
dest: /home/pi/.bashrc
|
|
||||||
line: "\nalias pwnkill='sudo killall -USR1 pwnagotchi'"
|
|
||||||
insertafter: EOF
|
|
||||||
|
|
||||||
- name: add firmware packages to hold
|
- name: add firmware packages to hold
|
||||||
dpkg_selections:
|
dpkg_selections:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
|
@ -32,7 +32,7 @@ main.plugins.bt-tether.devices.android-phone.netmask = 24
|
|||||||
main.plugins.bt-tether.devices.android-phone.interval = 1
|
main.plugins.bt-tether.devices.android-phone.interval = 1
|
||||||
main.plugins.bt-tether.devices.android-phone.scantime = 10
|
main.plugins.bt-tether.devices.android-phone.scantime = 10
|
||||||
main.plugins.bt-tether.devices.android-phone.max_tries = 10
|
main.plugins.bt-tether.devices.android-phone.max_tries = 10
|
||||||
main.plugins.bt-tether.devices.android-phone.share_internet = false
|
main.plugins.bt-tether.devices.android-phone.share_internet = true
|
||||||
main.plugins.bt-tether.devices.android-phone.priority = 1
|
main.plugins.bt-tether.devices.android-phone.priority = 1
|
||||||
|
|
||||||
main.plugins.bt-tether.devices.ios-phone.enabled = false
|
main.plugins.bt-tether.devices.ios-phone.enabled = false
|
||||||
@ -43,7 +43,7 @@ main.plugins.bt-tether.devices.ios-phone.netmask = 24
|
|||||||
main.plugins.bt-tether.devices.ios-phone.interval = 5
|
main.plugins.bt-tether.devices.ios-phone.interval = 5
|
||||||
main.plugins.bt-tether.devices.ios-phone.scantime = 20
|
main.plugins.bt-tether.devices.ios-phone.scantime = 20
|
||||||
main.plugins.bt-tether.devices.ios-phone.max_tries = 0
|
main.plugins.bt-tether.devices.ios-phone.max_tries = 0
|
||||||
main.plugins.bt-tether.devices.ios-phone.share_internet = false
|
main.plugins.bt-tether.devices.ios-phone.share_internet = true
|
||||||
main.plugins.bt-tether.devices.ios-phone.priority = 999
|
main.plugins.bt-tether.devices.ios-phone.priority = 999
|
||||||
|
|
||||||
main.plugins.fix_services.enabled = true
|
main.plugins.fix_services.enabled = true
|
||||||
@ -154,6 +154,8 @@ personality.throttle_d = 0.9
|
|||||||
|
|
||||||
personality.clear_on_exit = true # clear display when shutting down cleanly
|
personality.clear_on_exit = true # clear display when shutting down cleanly
|
||||||
|
|
||||||
|
ui.invert = false # false = black background, true = white background
|
||||||
|
|
||||||
ui.fps = 0.0
|
ui.fps = 0.0
|
||||||
ui.font.name = "DejaVuSansMono" # for japanese: fonts-japanese-gothic
|
ui.font.name = "DejaVuSansMono" # for japanese: fonts-japanese-gothic
|
||||||
ui.font.size_offset = 0 # will be added to the font size
|
ui.font.size_offset = 0 # will be added to the font size
|
||||||
|
@ -9,8 +9,7 @@ class WaveshareV1(DisplayImpl):
|
|||||||
super(WaveshareV1, self).__init__(config, 'waveshare_1')
|
super(WaveshareV1, self).__init__(config, 'waveshare_1')
|
||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
if self.config['color'] == 'black':
|
fonts.setup(10, 8, 10, 35, 25, 9)
|
||||||
fonts.setup(10, 9, 10, 35, 25, 9)
|
|
||||||
self._layout['width'] = 250
|
self._layout['width'] = 250
|
||||||
self._layout['height'] = 122
|
self._layout['height'] = 122
|
||||||
self._layout['face'] = (0, 40)
|
self._layout['face'] = (0, 40)
|
||||||
@ -29,61 +28,19 @@ class WaveshareV1(DisplayImpl):
|
|||||||
'font': fonts.status_font(fonts.Medium),
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
else:
|
|
||||||
fonts.setup(10, 8, 10, 25, 25, 9)
|
|
||||||
self._layout['width'] = 212
|
|
||||||
self._layout['height'] = 104
|
|
||||||
self._layout['face'] = (0, 26)
|
|
||||||
self._layout['name'] = (5, 15)
|
|
||||||
self._layout['channel'] = (0, 0)
|
|
||||||
self._layout['aps'] = (28, 0)
|
|
||||||
self._layout['uptime'] = (147, 0)
|
|
||||||
self._layout['line1'] = [0, 12, 212, 12]
|
|
||||||
self._layout['line2'] = [0, 92, 212, 92]
|
|
||||||
self._layout['friend_face'] = (0, 76)
|
|
||||||
self._layout['friend_name'] = (40, 78)
|
|
||||||
self._layout['shakes'] = (0, 93)
|
|
||||||
self._layout['mode'] = (187, 93)
|
|
||||||
self._layout['status'] = {
|
|
||||||
'pos': (91, 15),
|
|
||||||
'font': fonts.status_font(fonts.Medium),
|
|
||||||
'max': 20
|
|
||||||
}
|
|
||||||
return self._layout
|
return self._layout
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
if self.config['color'] == 'black':
|
|
||||||
logging.info("initializing waveshare v2in13_V1 display in monochromatic mode")
|
logging.info("initializing waveshare v2in13_V1 display in monochromatic mode")
|
||||||
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13 import EPD
|
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13 import EPD
|
||||||
self._display = EPD()
|
self._display = EPD()
|
||||||
self._display.init(self._display.lut_full_update)
|
self._display.init(self._display.lut_full_update)
|
||||||
self._display.Clear(0xFF)
|
self._display.Clear(0xFF)
|
||||||
self._display.init(self._display.lut_partial_update)
|
self._display.init(self._display.lut_partial_update)
|
||||||
elif self.config['color'] == 'fastAndFurious':
|
|
||||||
logging.info("initializing waveshare v2in13_V1 3-color display in FAST MODE")
|
|
||||||
logging.info("THIS MAY BE POTENTIALLY DANGEROUS. NO WARRANTY IS PROVIDED")
|
|
||||||
logging.info("USE THIS DISPLAY IN THIS MODE AT YOUR OWN RISK")
|
|
||||||
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13bcFAST import EPD
|
|
||||||
self._display = EPD()
|
|
||||||
self._display.init()
|
|
||||||
self._display.Clear()
|
|
||||||
else:
|
|
||||||
logging.info("initializing waveshare v2in13_V1 display 3-color mode")
|
|
||||||
from pwnagotchi.ui.hw.libs.waveshare.v2in13_V1.epd2in13bc import EPD
|
|
||||||
self._display = EPD()
|
|
||||||
self._display.init()
|
|
||||||
self._display.Clear()
|
|
||||||
|
|
||||||
def render(self, canvas):
|
def render(self, canvas):
|
||||||
if self.config['color'] == 'black':
|
|
||||||
buf = self._display.getbuffer(canvas)
|
buf = self._display.getbuffer(canvas)
|
||||||
self._display.display(buf)
|
self._display.display(buf)
|
||||||
elif self.config['color'] == 'fastAndFurious':
|
|
||||||
buf_black = self._display.getbuffer(canvas)
|
|
||||||
self._display.DisplayPartial(buf_black)
|
|
||||||
else:
|
|
||||||
buf_black = self._display.getbuffer(canvas)
|
|
||||||
self._display.displayBlack(buf_black)
|
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self._display.Clear(0xff)
|
self._display.Clear(0xff)
|
||||||
|
@ -9,8 +9,7 @@ class WaveshareV2(DisplayImpl):
|
|||||||
super(WaveshareV2, self).__init__(config, 'waveshare_2')
|
super(WaveshareV2, self).__init__(config, 'waveshare_2')
|
||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
if self.config['color'] == 'black':
|
fonts.setup(10, 8, 10, 35, 25, 9)
|
||||||
fonts.setup(10, 9, 10, 35, 25, 9)
|
|
||||||
self._layout['width'] = 250
|
self._layout['width'] = 250
|
||||||
self._layout['height'] = 122
|
self._layout['height'] = 122
|
||||||
self._layout['face'] = (0, 40)
|
self._layout['face'] = (0, 40)
|
||||||
@ -29,27 +28,6 @@ class WaveshareV2(DisplayImpl):
|
|||||||
'font': fonts.status_font(fonts.Medium),
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
else:
|
|
||||||
fonts.setup(10, 8, 10, 25, 25, 9)
|
|
||||||
self._layout['width'] = 212
|
|
||||||
self._layout['height'] = 104
|
|
||||||
self._layout['face'] = (0, 26)
|
|
||||||
self._layout['name'] = (5, 15)
|
|
||||||
self._layout['channel'] = (0, 0)
|
|
||||||
self._layout['aps'] = (28, 0)
|
|
||||||
self._layout['status'] = (91, 15)
|
|
||||||
self._layout['uptime'] = (147, 0)
|
|
||||||
self._layout['line1'] = [0, 12, 212, 12]
|
|
||||||
self._layout['line2'] = [0, 92, 212, 92]
|
|
||||||
self._layout['friend_face'] = (0, 76)
|
|
||||||
self._layout['friend_name'] = (40, 78)
|
|
||||||
self._layout['shakes'] = (0, 93)
|
|
||||||
self._layout['mode'] = (187, 93)
|
|
||||||
self._layout['status'] = {
|
|
||||||
'pos': (125, 20),
|
|
||||||
'font': fonts.status_font(fonts.Medium),
|
|
||||||
'max': 14
|
|
||||||
}
|
|
||||||
return self._layout
|
return self._layout
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
|
@ -10,7 +10,6 @@ class Waveshare2in13bV3(DisplayImpl):
|
|||||||
super(Waveshare2in13bV3, self).__init__(config, 'waveshare2in13b_v3')
|
super(Waveshare2in13bV3, self).__init__(config, 'waveshare2in13b_v3')
|
||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
if self.config['color'] == 'black':
|
|
||||||
fonts.setup(10, 9, 10, 35, 25, 9)
|
fonts.setup(10, 9, 10, 35, 25, 9)
|
||||||
self._layout['width'] = 250
|
self._layout['width'] = 250
|
||||||
self._layout['height'] = 122
|
self._layout['height'] = 122
|
||||||
@ -30,27 +29,6 @@ class Waveshare2in13bV3(DisplayImpl):
|
|||||||
'font': fonts.status_font(fonts.Medium),
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
else:
|
|
||||||
fonts.setup(10, 8, 10, 25, 25, 9)
|
|
||||||
self._layout['width'] = 212
|
|
||||||
self._layout['height'] = 104
|
|
||||||
self._layout['face'] = (0, 26)
|
|
||||||
self._layout['name'] = (5, 15)
|
|
||||||
self._layout['channel'] = (0, 0)
|
|
||||||
self._layout['aps'] = (28, 0)
|
|
||||||
self._layout['status'] = (91, 15)
|
|
||||||
self._layout['uptime'] = (147, 0)
|
|
||||||
self._layout['line1'] = [0, 12, 212, 12]
|
|
||||||
self._layout['line2'] = [0, 92, 212, 92]
|
|
||||||
self._layout['friend_face'] = (0, 76)
|
|
||||||
self._layout['friend_name'] = (40, 78)
|
|
||||||
self._layout['shakes'] = (0, 93)
|
|
||||||
self._layout['mode'] = (187, 93)
|
|
||||||
self._layout['status'] = {
|
|
||||||
'pos': (125, 20),
|
|
||||||
'font': fonts.status_font(fonts.Medium),
|
|
||||||
'max': 14
|
|
||||||
}
|
|
||||||
return self._layout
|
return self._layout
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
|
@ -10,7 +10,6 @@ class Waveshare213bV4(DisplayImpl):
|
|||||||
super(Waveshare213bV4, self).__init__(config, 'waveshare2in13b_v4')
|
super(Waveshare213bV4, self).__init__(config, 'waveshare2in13b_v4')
|
||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
if self.config['color'] == 'black':
|
|
||||||
fonts.setup(10, 9, 10, 35, 25, 9)
|
fonts.setup(10, 9, 10, 35, 25, 9)
|
||||||
self._layout['width'] = 250
|
self._layout['width'] = 250
|
||||||
self._layout['height'] = 122
|
self._layout['height'] = 122
|
||||||
@ -30,27 +29,6 @@ class Waveshare213bV4(DisplayImpl):
|
|||||||
'font': fonts.status_font(fonts.Medium),
|
'font': fonts.status_font(fonts.Medium),
|
||||||
'max': 20
|
'max': 20
|
||||||
}
|
}
|
||||||
else:
|
|
||||||
fonts.setup(10, 8, 10, 25, 25, 9)
|
|
||||||
self._layout['width'] = 212
|
|
||||||
self._layout['height'] = 104
|
|
||||||
self._layout['face'] = (0, 26)
|
|
||||||
self._layout['name'] = (5, 15)
|
|
||||||
self._layout['channel'] = (0, 0)
|
|
||||||
self._layout['aps'] = (28, 0)
|
|
||||||
self._layout['status'] = (91, 15)
|
|
||||||
self._layout['uptime'] = (147, 0)
|
|
||||||
self._layout['line1'] = [0, 12, 212, 12]
|
|
||||||
self._layout['line2'] = [0, 92, 212, 92]
|
|
||||||
self._layout['friend_face'] = (0, 76)
|
|
||||||
self._layout['friend_name'] = (40, 78)
|
|
||||||
self._layout['shakes'] = (0, 93)
|
|
||||||
self._layout['mode'] = (187, 93)
|
|
||||||
self._layout['status'] = {
|
|
||||||
'pos': (125, 20),
|
|
||||||
'font': fonts.status_font(fonts.Medium),
|
|
||||||
'max': 14
|
|
||||||
}
|
|
||||||
return self._layout
|
return self._layout
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
|
@ -35,13 +35,11 @@ class Waveshare27inchV2(DisplayImpl):
|
|||||||
from pwnagotchi.ui.hw.libs.waveshare.v2in7_v2.epd2in7_V2 import EPD
|
from pwnagotchi.ui.hw.libs.waveshare.v2in7_v2.epd2in7_V2 import EPD
|
||||||
self._display = EPD()
|
self._display = EPD()
|
||||||
self._display.init()
|
self._display.init()
|
||||||
# this must have changed by waveshare
|
|
||||||
# remove the 0xFF(Clear(0xFF)) other wise it errors. can't pass oxff and self
|
|
||||||
self._display.Clear()
|
self._display.Clear()
|
||||||
|
|
||||||
def render(self, canvas):
|
def render(self, canvas):
|
||||||
buf = self._display.getbuffer(canvas)
|
buf = self._display.getbuffer(canvas)
|
||||||
self._display.display_Partial(buf, 0, 0, 176, 264)
|
self._display.display_Fast(buf)
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
# This line also removes the 0xFF
|
# This line also removes the 0xFF
|
||||||
|
Reference in New Issue
Block a user