mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
ac345c2ee7 | |||
468cfd9f4f | |||
d6bc5c0e66 | |||
4905eb6b26 | |||
697a7778b1 | |||
9287283ee7 | |||
8013109ef7 | |||
f140fe1a2d | |||
8fe503c67d | |||
d81013412e | |||
3c701822bd | |||
2f5ddb492a | |||
9e3324221d | |||
b069b82984 | |||
cb7d965271 |
20
.github/workflows/publish.yml
vendored
20
.github/workflows/publish.yml
vendored
@ -20,21 +20,6 @@ jobs:
|
||||
VERSION=$(cut -d "'" -f2 < pwnagotchi/_version.py)
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Get latest tag
|
||||
uses: actions-ecosystem/action-get-latest-tag@v1
|
||||
id: get-latest-tag
|
||||
|
||||
- name: Set LAST_VERSION as an environment variable
|
||||
run: echo "LAST_VERSION=${{ steps.get-latest-tag.outputs.tag }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Generate release notes
|
||||
id: generate_release_notes
|
||||
run: |
|
||||
COMMITS=$(git log --merges --pretty=format:"* %s" $LAST_VERSION--$VERSION | sed 's/$/\\n/g')
|
||||
CONTRIBUTORS=$(git shortlog -sn $LAST_VERSION--$VERSION | awk '{print "* @" $2}' | sed 's/$/\\n/g')
|
||||
RELEASE_BODY="**Full Changelog**: https://github.com/jayofelony/pwnagotchi/compare/$LAST_VERSION...$VERSION"
|
||||
echo "RELEASE_BODY=$RELEASE_BODY" >> $GITHUB_ENV
|
||||
|
||||
- name: Install qemu dependencies
|
||||
run: sudo apt update && sudo apt install qemu-user-static qemu-utils xz-utils -y
|
||||
|
||||
@ -63,10 +48,11 @@ jobs:
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
prerelease: true
|
||||
prerelease: false
|
||||
make_latest: true
|
||||
tag_name: v${{ env.VERSION }}
|
||||
name: Pwnagotchi v${{ env.VERSION }}
|
||||
files: |
|
||||
pwnagotchi-${{ env.VERSION }}-32bit.img.xz
|
||||
pwnagotchi-${{ env.VERSION }}-64bit.img.xz
|
||||
body: ${{ env.RELEASE_BODY }}
|
||||
generate_release_notes: true
|
@ -1 +0,0 @@
|
||||
bluez-tools
|
@ -264,8 +264,7 @@ def pwnagotchi_cli():
|
||||
sys.exit(0)
|
||||
|
||||
if args.donate:
|
||||
print("Donations can made @ \n "
|
||||
"https://www.patreon.com/pwnagotchi_torch \n "
|
||||
print("Donations can be made @ \n "
|
||||
"https://github.com/sponsors/jayofelony \n\n"
|
||||
"But only if you really want to!")
|
||||
sys.exit(0)
|
||||
@ -278,8 +277,7 @@ def pwnagotchi_cli():
|
||||
local = version_to_tuple(pwnagotchi.__version__)
|
||||
remote = version_to_tuple(latest_ver)
|
||||
if remote > local:
|
||||
user_input = input("There is a new version available! Update from v%s to v%s?\n[Y/N] "
|
||||
% (pwnagotchi.__version__, latest_ver))
|
||||
user_input = input("There is a new version available! Update from v%s to v%s?\n[Y/N] " % (pwnagotchi.__version__, latest_ver))
|
||||
# input validation
|
||||
if user_input.lower() in ('y', 'yes'):
|
||||
if os.path.exists('/root/.auto-update'):
|
||||
@ -334,5 +332,6 @@ def pwnagotchi_cli():
|
||||
else:
|
||||
do_auto_mode(agent)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
pwnagotchi_cli()
|
||||
pwnagotchi_cli()
|
||||
|
@ -20,6 +20,7 @@ echo " I'm managed by systemd. Here are some basic commands."
|
||||
echo
|
||||
echo " If you want to know what I'm doing, you can check my logs with the command"
|
||||
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 --donate, to see how you can donate to this project"
|
||||
echo " - sudo pwnagotchi --check-update, to see if there is a new version available"
|
||||
@ -30,4 +31,4 @@ echo
|
||||
echo " You can restart me using"
|
||||
echo " pwnkill"
|
||||
echo
|
||||
echo " You learn more about me at https://pwnagotchi.ai/"
|
||||
echo " You can learn more about me at https://pwnagotchi.org/"
|
@ -2,7 +2,7 @@
|
||||
_hostname=$(hostname)
|
||||
_version=$(cut -d"'" -f2 < /usr/local/lib/python3.11/dist-packages/pwnagotchi/_version.py)
|
||||
echo
|
||||
echo "(☉_☉ ) $_hostname"
|
||||
echo "(◕‿‿◕) $_hostname"
|
||||
echo
|
||||
echo " Hi! I'm a pwnagotchi $_version, please take good care of me!"
|
||||
echo " Here are some basic things you need to know to raise me properly!"
|
||||
|
@ -1 +1 @@
|
||||
__version__ = '2.8.8'
|
||||
__version__ = '2.8.9'
|
||||
|
@ -230,7 +230,7 @@ class AutoUpdate(plugins.Plugin):
|
||||
if num_installed > 0:
|
||||
display.update(force=True, new_data={'status': 'Rebooting ...'})
|
||||
time.sleep(3)
|
||||
os.system("service pwnagotchi restart")
|
||||
pwnagotchi.reboot()
|
||||
|
||||
except Exception as e:
|
||||
logging.error("[update] %s" % e)
|
||||
|
@ -5,7 +5,6 @@ import time
|
||||
import random
|
||||
from io import TextIOWrapper
|
||||
import os
|
||||
import platform
|
||||
|
||||
import pwnagotchi
|
||||
from pwnagotchi import plugins
|
||||
@ -117,43 +116,41 @@ class FixServices(plugins.Plugin):
|
||||
logging.debug("[Fix_Services]**** checking")
|
||||
|
||||
# Look for pattern 1
|
||||
if platform.machine().startswith('arm'):
|
||||
if len(self.pattern.findall(last_lines)) >= 3:
|
||||
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
|
||||
if hasattr(agent, 'view'):
|
||||
display = agent.view()
|
||||
display.set('status', 'Blind-Bug detected. Restarting.')
|
||||
display.update(force=True)
|
||||
logging.debug('[Fix_Services] Blind-Bug detected. Restarting.')
|
||||
try:
|
||||
self._tryTurningItOffAndOnAgain(agent)
|
||||
except Exception as err:
|
||||
logging.warning("[Fix_Services] TTOAOA: %s" % repr(err))
|
||||
if len(self.pattern.findall(last_lines)) >= 3:
|
||||
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
|
||||
if hasattr(agent, 'view'):
|
||||
display = agent.view()
|
||||
display.set('status', 'Blind-Bug detected. Restarting.')
|
||||
display.update(force=True)
|
||||
logging.debug('[Fix_Services] Blind-Bug detected. Restarting.')
|
||||
try:
|
||||
self._tryTurningItOffAndOnAgain(agent)
|
||||
except Exception as err:
|
||||
logging.warning("[Fix_Services] TTOAOA: %s" % repr(err))
|
||||
|
||||
# Look for pattern 2
|
||||
elif len(self.pattern2.findall(other_last_lines)) >= 5:
|
||||
if platform.machine().startswith('arm'):
|
||||
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
|
||||
if hasattr(agent, 'view'):
|
||||
display = agent.view()
|
||||
display.set('status', 'Wifi channel stuck. Restarting recon.')
|
||||
display.update(force=True)
|
||||
logging.debug('[Fix_Services] Wifi channel stuck. Restarting recon.')
|
||||
logging.debug("[Fix_Services]**** Should trigger a reload of the wlan0mon device:\n%s" % last_lines)
|
||||
if hasattr(agent, 'view'):
|
||||
display = agent.view()
|
||||
display.set('status', 'Wifi channel stuck. Restarting recon.')
|
||||
display.update(force=True)
|
||||
logging.debug('[Fix_Services] Wifi channel stuck. Restarting recon.')
|
||||
|
||||
try:
|
||||
result = agent.run("wifi.recon off; wifi.recon on")
|
||||
if result["success"]:
|
||||
logging.debug("[Fix_Services] wifi.recon flip: success!")
|
||||
if display:
|
||||
display.update(force=True, new_data={"status": "Wifi recon flipped!",
|
||||
"face": faces.COOL})
|
||||
else:
|
||||
print("Wifi recon flipped\nthat was easy!")
|
||||
try:
|
||||
result = agent.run("wifi.recon off; wifi.recon on")
|
||||
if result["success"]:
|
||||
logging.debug("[Fix_Services] wifi.recon flip: success!")
|
||||
if display:
|
||||
display.update(force=True, new_data={"status": "Wifi recon flipped!",
|
||||
"face": faces.COOL})
|
||||
else:
|
||||
logging.warning("[Fix_Services] wifi.recon flip: FAILED: %s" % repr(result))
|
||||
print("Wifi recon flipped\nthat was easy!")
|
||||
else:
|
||||
logging.warning("[Fix_Services] wifi.recon flip: FAILED: %s" % repr(result))
|
||||
|
||||
except Exception as err:
|
||||
logging.error("[Fix_Services wifi.recon flip] %s" % repr(err))
|
||||
except Exception as err:
|
||||
logging.error("[Fix_Services wifi.recon flip] %s" % repr(err))
|
||||
|
||||
# Look for pattern 3
|
||||
elif len(self.pattern3.findall(other_last_lines)) >= 1:
|
||||
|
@ -253,7 +253,6 @@ class Logtail(plugins.Plugin):
|
||||
"""
|
||||
logging.info("Logtail plugin loaded.")
|
||||
|
||||
|
||||
def on_webhook(self, path, request):
|
||||
if not self.ready:
|
||||
return "Plugin not ready"
|
||||
|
@ -28,6 +28,39 @@ class Display(View):
|
||||
def is_lcdhat(self):
|
||||
return self._implementation.name == 'lcdhat'
|
||||
|
||||
def is_wavesharelcd0in96(self):
|
||||
return self._implementation.name == 'wavesharelcd0in96'
|
||||
|
||||
def is_wavesharelcd1in3(self):
|
||||
return self._implementation.name == 'wavesharelcd1in3'
|
||||
|
||||
def is_wavesharelcd1in8(self):
|
||||
return self._implementation.name == 'wavesharelcd1in8'
|
||||
|
||||
def is_wavesharelcd1in9(self):
|
||||
return self._implementation.name == 'wavesharelcd1in9'
|
||||
|
||||
def is_wavesharelcd1in14(self):
|
||||
return self._implementation.name == 'wavesharelcd1in14'
|
||||
|
||||
def is_wavesharelcd1in28(self):
|
||||
return self._implementation.name == 'wavesharelcd1in28'
|
||||
|
||||
def is_wavesharelcd1in47(self):
|
||||
return self._implementation.name == 'wavesharelcd1in47'
|
||||
|
||||
def is_wavesharelcd1in54(self):
|
||||
return self._implementation.name == 'wavesharelcd1in54'
|
||||
|
||||
def is_wavesharelcd1in69(self):
|
||||
return self._implementation.name == 'wavesharelcd1in69'
|
||||
|
||||
def is_wavesharelcd2in0(self):
|
||||
return self._implementation.name == 'wavesharelcd2in0'
|
||||
|
||||
def is_wavesharelcd2in4(self):
|
||||
return self._implementation.name == 'wavesharelcd2in4'
|
||||
|
||||
def is_waveshare144lcd(self):
|
||||
return self._implementation.name == 'waveshare144lcd'
|
||||
|
||||
|
@ -1,291 +1,333 @@
|
||||
from pwnagotchi.ui.hw.inky import Inky
|
||||
from pwnagotchi.ui.hw.dummydisplay import DummyDisplay
|
||||
from pwnagotchi.ui.hw.papirus import Papirus
|
||||
from pwnagotchi.ui.hw.oledhat import OledHat
|
||||
from pwnagotchi.ui.hw.lcdhat import LcdHat
|
||||
from pwnagotchi.ui.hw.dfrobot import DFRobotV1
|
||||
from pwnagotchi.ui.hw.dfrobot_v2 import DFRobotV2
|
||||
from pwnagotchi.ui.hw.waveshare2in13 import WaveshareV1
|
||||
from pwnagotchi.ui.hw.waveshare2in13_V2 import WaveshareV2
|
||||
from pwnagotchi.ui.hw.waveshare2in13_V3 import WaveshareV3
|
||||
from pwnagotchi.ui.hw.waveshare2in13_V4 import WaveshareV4
|
||||
from pwnagotchi.ui.hw.waveshare2in7 import Waveshare27inch
|
||||
from pwnagotchi.ui.hw.waveshare2in7_V2 import Waveshare27inchV2
|
||||
from pwnagotchi.ui.hw.waveshare2in9 import Waveshare29inch
|
||||
from pwnagotchi.ui.hw.waveshare2in9_V2 import Waveshare29inchV2
|
||||
from pwnagotchi.ui.hw.waveshare1in44lcd import Waveshare144lcd
|
||||
from pwnagotchi.ui.hw.waveshare1in54b import Waveshare154inchb
|
||||
from pwnagotchi.ui.hw.waveshare2in13bc import Waveshare213bc
|
||||
from pwnagotchi.ui.hw.waveshare2in13d import Waveshare213d
|
||||
from pwnagotchi.ui.hw.waveshare2in13g import Waveshare2in13g
|
||||
from pwnagotchi.ui.hw.waveshare2in13b_V4 import Waveshare213bV4
|
||||
from pwnagotchi.ui.hw.waveshare3in5lcd import Waveshare35lcd
|
||||
from pwnagotchi.ui.hw.spotpear24in import Spotpear24inch
|
||||
from pwnagotchi.ui.hw.displayhatmini import DisplayHatMini
|
||||
from pwnagotchi.ui.hw.pirateaudio import PirateAudio
|
||||
from pwnagotchi.ui.hw.pitft import Pitft
|
||||
from pwnagotchi.ui.hw.tftbonnet import TftBonnet
|
||||
from pwnagotchi.ui.hw.adafruit2in13 import Adafruit2in13V3
|
||||
from pwnagotchi.ui.hw.waveshareoledlcd import Waveshareoledlcd
|
||||
from pwnagotchi.ui.hw.waveshare1in02 import Waveshare1in02
|
||||
from pwnagotchi.ui.hw.waveshare1in54 import Waveshare154
|
||||
from pwnagotchi.ui.hw.waveshare1in54_V2 import Waveshare154V2
|
||||
from pwnagotchi.ui.hw.waveshare1in54b_V2 import Waveshare154bV2
|
||||
from pwnagotchi.ui.hw.waveshare1in54c import Waveshare1in54c
|
||||
from pwnagotchi.ui.hw.waveshare1in64g import Waveshare1in64g
|
||||
from pwnagotchi.ui.hw.waveshare2in7b import Waveshare27b
|
||||
from pwnagotchi.ui.hw.waveshare2in7b_V2 import Waveshare27bV2
|
||||
from pwnagotchi.ui.hw.waveshare2in9b_V3 import Waveshare29bV3
|
||||
from pwnagotchi.ui.hw.waveshare2in9b_V4 import Waveshare29bV4
|
||||
from pwnagotchi.ui.hw.waveshare2in9bc import Waveshare2in9bc
|
||||
from pwnagotchi.ui.hw.waveshare2in9d import Waveshare2in9d
|
||||
from pwnagotchi.ui.hw.waveshare2in13b_V3 import Waveshare2in13bV3
|
||||
from pwnagotchi.ui.hw.waveshare2in36g import Waveshare2in36g
|
||||
from pwnagotchi.ui.hw.waveshare2in66 import Waveshare2in66
|
||||
from pwnagotchi.ui.hw.waveshare2in66b import Waveshare2in66b
|
||||
from pwnagotchi.ui.hw.waveshare2in66g import Waveshare2in66g
|
||||
from pwnagotchi.ui.hw.waveshare3in0g import Waveshare3in0g
|
||||
from pwnagotchi.ui.hw.waveshare3in7 import Waveshare3in7
|
||||
from pwnagotchi.ui.hw.waveshare3in52 import Waveshare3in52
|
||||
from pwnagotchi.ui.hw.waveshare4in01f import Waveshare4in01f
|
||||
from pwnagotchi.ui.hw.waveshare4in2 import Waveshare4in2
|
||||
from pwnagotchi.ui.hw.waveshare4in2_V2 import Waveshare4in2V2
|
||||
from pwnagotchi.ui.hw.waveshare4in2b_V2 import Waveshare4in2bV2
|
||||
from pwnagotchi.ui.hw.waveshare4in2bc import Waveshare4in2bc
|
||||
from pwnagotchi.ui.hw.waveshare4in26 import Waveshare4in26
|
||||
from pwnagotchi.ui.hw.waveshare4in37g import Waveshare4in37g
|
||||
from pwnagotchi.ui.hw.waveshare5in65f import Waveshare5in65f
|
||||
from pwnagotchi.ui.hw.waveshare5in79 import Waveshare5in79
|
||||
from pwnagotchi.ui.hw.waveshare5in79b import Waveshare5in79b
|
||||
from pwnagotchi.ui.hw.waveshare5in83 import Waveshare5in83
|
||||
from pwnagotchi.ui.hw.waveshare5in83_V2 import Waveshare5in83V2
|
||||
from pwnagotchi.ui.hw.waveshare5in83b_V2 import Waveshare5in83bV2
|
||||
from pwnagotchi.ui.hw.waveshare5in83bc import Waveshare5in83bc
|
||||
from pwnagotchi.ui.hw.waveshare7in3f import Waveshare7in3f
|
||||
from pwnagotchi.ui.hw.waveshare7in3g import Waveshare7in3g
|
||||
from pwnagotchi.ui.hw.waveshare7in5 import Waveshare7in5
|
||||
from pwnagotchi.ui.hw.waveshare7in5_HD import Waveshare7in5HD
|
||||
from pwnagotchi.ui.hw.waveshare7in5_V2 import Waveshare7in5V2
|
||||
from pwnagotchi.ui.hw.waveshare7in5b_HD import Waveshare7in5bHD
|
||||
from pwnagotchi.ui.hw.waveshare7in5b_V2 import Waveshare7in5bV2
|
||||
from pwnagotchi.ui.hw.waveshare7in5bc import Waveshare7in5bc
|
||||
from pwnagotchi.ui.hw.waveshare13in3k import Waveshare13in3k
|
||||
|
||||
|
||||
def display_for(config):
|
||||
# config has been normalized already in utils.load_config
|
||||
if config['ui']['display']['type'] == 'inky':
|
||||
from pwnagotchi.ui.hw.inky import Inky
|
||||
return Inky(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd0in96':
|
||||
from pwnagotchi.ui.hw.wavesharelcd0in96 import Wavesharelcd0in96
|
||||
return Wavesharelcd0in96(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd1in3':
|
||||
from pwnagotchi.ui.hw.wavesharelcd1in3 import Wavesharelcd1in3
|
||||
return Wavesharelcd1in3(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd1in8':
|
||||
from pwnagotchi.ui.hw.wavesharelcd1in8 import Wavesharelcd1in8
|
||||
return Wavesharelcd1in8(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd1in9':
|
||||
from pwnagotchi.ui.hw.wavesharelcd1in9 import Wavesharelcd1in9
|
||||
return Wavesharelcd1in9(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd1in14':
|
||||
from pwnagotchi.ui.hw.wavesharelcd1in14 import Wavesharelcd1in14
|
||||
return Wavesharelcd1in14(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd1in28':
|
||||
from pwnagotchi.ui.hw.wavesharelcd1in28 import Wavesharelcd1in28
|
||||
return Wavesharelcd1in28(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd1in47':
|
||||
from pwnagotchi.ui.hw.wavesharelcd1in47 import Wavesharelcd1in47
|
||||
return Wavesharelcd1in47(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd1in54':
|
||||
from pwnagotchi.ui.hw.wavesharelcd1in54 import Wavesharelcd1in54
|
||||
return Wavesharelcd1in54(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd1in69':
|
||||
from pwnagotchi.ui.hw.wavesharelcd1in69 import Wavesharelcd1in69
|
||||
return Wavesharelcd1in69(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd2in0':
|
||||
from pwnagotchi.ui.hw.wavesharelcd2in0 import Wavesharelcd2in0
|
||||
return Wavesharelcd2in0(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'wavesharelcd2in4':
|
||||
from pwnagotchi.ui.hw.wavesharelcd2in4 import Wavesharelcd2in4
|
||||
return Wavesharelcd2in4(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'dummydisplay':
|
||||
from pwnagotchi.ui.hw.dummydisplay import DummyDisplay
|
||||
return DummyDisplay(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'papirus':
|
||||
from pwnagotchi.ui.hw.papirus import Papirus
|
||||
return Papirus(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'oledhat':
|
||||
from pwnagotchi.ui.hw.oledhat import OledHat
|
||||
return OledHat(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'lcdhat':
|
||||
from pwnagotchi.ui.hw.lcdhat import LcdHat
|
||||
return LcdHat(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'dfrobot_1':
|
||||
from pwnagotchi.ui.hw.dfrobot import DFRobotV1
|
||||
return DFRobotV1(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'dfrobot_2':
|
||||
from pwnagotchi.ui.hw.dfrobot_v2 import DFRobotV2
|
||||
return DFRobotV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare144lcd':
|
||||
from pwnagotchi.ui.hw.waveshare1in44lcd import Waveshare144lcd
|
||||
return Waveshare144lcd(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare35lcd':
|
||||
from pwnagotchi.ui.hw.waveshare3in5lcd import Waveshare35lcd
|
||||
return Waveshare35lcd(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'spotpear24inch':
|
||||
from pwnagotchi.ui.hw.spotpear24in import Spotpear24inch
|
||||
return Spotpear24inch(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'displayhatmini':
|
||||
from pwnagotchi.ui.hw.displayhatmini import DisplayHatMini
|
||||
return DisplayHatMini(config)
|
||||
|
||||
|
||||
elif config['ui']['display']['type'] == 'pirateaudio':
|
||||
from pwnagotchi.ui.hw.pirateaudio import PirateAudio
|
||||
return PirateAudio(config)
|
||||
|
||||
|
||||
elif config['ui']['display']['type'] == 'pitft':
|
||||
from pwnagotchi.ui.hw.pitft import Pitft
|
||||
return Pitft(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'tftbonnet':
|
||||
from pwnagotchi.ui.hw.tftbonnet import TftBonnet
|
||||
return TftBonnet(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshareoledlcd':
|
||||
from pwnagotchi.ui.hw.waveshareoledlcd import Waveshareoledlcd
|
||||
return Waveshareoledlcd(config)
|
||||
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare1in02':
|
||||
from pwnagotchi.ui.hw.waveshare1in02 import Waveshare1in02
|
||||
return Waveshare1in02(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare1in54':
|
||||
from pwnagotchi.ui.hw.waveshare1in54 import Waveshare154
|
||||
return Waveshare154(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare1in54_v2':
|
||||
from pwnagotchi.ui.hw.waveshare1in54_V2 import Waveshare154V2
|
||||
return Waveshare154V2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare1in54b':
|
||||
from pwnagotchi.ui.hw.waveshare1in54b import Waveshare154inchb
|
||||
return Waveshare154inchb(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare1in54b_v2':
|
||||
from pwnagotchi.ui.hw.waveshare1in54b_V2 import Waveshare154bV2
|
||||
return Waveshare154bV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare1in54c':
|
||||
from pwnagotchi.ui.hw.waveshare1in54c import Waveshare1in54c
|
||||
return Waveshare1in54c(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare1in64g':
|
||||
from pwnagotchi.ui.hw.waveshare1in64g import Waveshare1in64g
|
||||
return Waveshare1in64g(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in7':
|
||||
from pwnagotchi.ui.hw.waveshare2in7 import Waveshare27inch
|
||||
return Waveshare27inch(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in7_v2':
|
||||
from pwnagotchi.ui.hw.waveshare2in7_V2 import Waveshare27inchV2
|
||||
return Waveshare27inchV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in7b':
|
||||
from pwnagotchi.ui.hw.waveshare2in7b import Waveshare27b
|
||||
return Waveshare27b(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in7b_v2':
|
||||
from pwnagotchi.ui.hw.waveshare2in7b_V2 import Waveshare27bV2
|
||||
return Waveshare27bV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in9':
|
||||
from pwnagotchi.ui.hw.waveshare2in9 import Waveshare29inch
|
||||
return Waveshare29inch(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in9bc':
|
||||
from pwnagotchi.ui.hw.waveshare2in9bc import Waveshare2in9bc
|
||||
return Waveshare2in9bc(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in9d':
|
||||
from pwnagotchi.ui.hw.waveshare2in9d import Waveshare2in9d
|
||||
return Waveshare2in9d(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in9_v2':
|
||||
from pwnagotchi.ui.hw.waveshare2in9_V2 import Waveshare29inchV2
|
||||
return Waveshare29inchV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in9b_v3':
|
||||
from pwnagotchi.ui.hw.waveshare2in9b_V3 import Waveshare29bV3
|
||||
return Waveshare29bV3(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in9b_v4':
|
||||
from pwnagotchi.ui.hw.waveshare2in9b_V4 import Waveshare29bV4
|
||||
return Waveshare29bV4(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare_1':
|
||||
from pwnagotchi.ui.hw.waveshare2in13 import WaveshareV1
|
||||
return WaveshareV1(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare_2':
|
||||
from pwnagotchi.ui.hw.waveshare2in13_V2 import WaveshareV2
|
||||
return WaveshareV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare_3':
|
||||
from pwnagotchi.ui.hw.waveshare2in13_V3 import WaveshareV3
|
||||
return WaveshareV3(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare_4':
|
||||
from pwnagotchi.ui.hw.waveshare2in13_V4 import WaveshareV4
|
||||
return WaveshareV4(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'adafruit2in13':
|
||||
return Adafruit2in13(config)
|
||||
elif config['ui']['display']['type'] == 'adafruit2in13_v3':
|
||||
from pwnagotchi.ui.hw.adafruit2in13 import Adafruit2in13V3
|
||||
return Adafruit2in13V3(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in13bc':
|
||||
from pwnagotchi.ui.hw.waveshare2in13bc import Waveshare213bc
|
||||
return Waveshare213bc(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in13d':
|
||||
from pwnagotchi.ui.hw.waveshare2in13d import Waveshare213d
|
||||
return Waveshare213d(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in13b_v3':
|
||||
from pwnagotchi.ui.hw.waveshare2in13b_V3 import Waveshare2in13bV3
|
||||
return Waveshare2in13bV3(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in13b_v4':
|
||||
from pwnagotchi.ui.hw.waveshare2in13b_V4 import Waveshare213bV4
|
||||
return Waveshare213bV4(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in13g':
|
||||
from pwnagotchi.ui.hw.waveshare2in13g import Waveshare2in13g
|
||||
return Waveshare2in13g(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in36g':
|
||||
from pwnagotchi.ui.hw.waveshare2in36g import Waveshare2in36g
|
||||
return Waveshare2in36g(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in66':
|
||||
from pwnagotchi.ui.hw.waveshare2in66 import Waveshare2in66
|
||||
return Waveshare2in66(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in66b':
|
||||
from pwnagotchi.ui.hw.waveshare2in66b import Waveshare2in66b
|
||||
return Waveshare2in66b(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare2in66g':
|
||||
from pwnagotchi.ui.hw.waveshare2in66g import Waveshare2in66g
|
||||
return Waveshare2in66g(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare3in0g':
|
||||
from pwnagotchi.ui.hw.waveshare3in0g import Waveshare3in0g
|
||||
return Waveshare3in0g(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare3in7':
|
||||
from pwnagotchi.ui.hw.waveshare3in7 import Waveshare3in7
|
||||
return Waveshare3in7(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare3in52':
|
||||
from pwnagotchi.ui.hw.waveshare3in52 import Waveshare3in52
|
||||
return Waveshare3in52(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare4in01f':
|
||||
from pwnagotchi.ui.hw.waveshare4in01f import Waveshare4in01f
|
||||
return Waveshare4in01f(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare4in2':
|
||||
from pwnagotchi.ui.hw.waveshare4in2 import Waveshare4in2
|
||||
return Waveshare4in2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare4in2_v2':
|
||||
from pwnagotchi.ui.hw.waveshare4in2_V2 import Waveshare4in2V2
|
||||
return Waveshare4in2V2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare4in2b_v2':
|
||||
from pwnagotchi.ui.hw.waveshare4in2b_V2 import Waveshare4in2bV2
|
||||
return Waveshare4in2bV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare4in2bc':
|
||||
from pwnagotchi.ui.hw.waveshare4in2bc import Waveshare4in2bc
|
||||
return Waveshare4in2bc(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare4in26':
|
||||
from pwnagotchi.ui.hw.waveshare4in26 import Waveshare4in26
|
||||
return Waveshare4in26(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare4in37g':
|
||||
from pwnagotchi.ui.hw.waveshare4in37g import Waveshare4in37g
|
||||
return Waveshare4in37g(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare5in65f':
|
||||
from pwnagotchi.ui.hw.waveshare5in65f import Waveshare5in65f
|
||||
return Waveshare5in65f(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare5in79':
|
||||
from pwnagotchi.ui.hw.waveshare5in79 import Waveshare5in79
|
||||
return Waveshare5in79(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare5in79b':
|
||||
from pwnagotchi.ui.hw.waveshare5in79b import Waveshare5in79b
|
||||
return Waveshare5in79b(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare5in83':
|
||||
from pwnagotchi.ui.hw.waveshare5in83 import Waveshare5in83
|
||||
return Waveshare5in83(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare5in83_v2':
|
||||
from pwnagotchi.ui.hw.waveshare5in83_V2 import Waveshare5in83V2
|
||||
return Waveshare5in83V2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare5in83b_v2':
|
||||
from pwnagotchi.ui.hw.waveshare5in83b_V2 import Waveshare5in83bV2
|
||||
return Waveshare5in83bV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare5in83bc':
|
||||
from pwnagotchi.ui.hw.waveshare5in83bc import Waveshare5in83bc
|
||||
return Waveshare5in83bc(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare7in3f':
|
||||
from pwnagotchi.ui.hw.waveshare7in3f import Waveshare7in3f
|
||||
return Waveshare7in3f(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare7in3g':
|
||||
from pwnagotchi.ui.hw.waveshare7in3g import Waveshare7in3g
|
||||
return Waveshare7in3g(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare7in5':
|
||||
from pwnagotchi.ui.hw.waveshare7in5 import Waveshare7in5
|
||||
return Waveshare7in5(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare7in5_HD':
|
||||
from pwnagotchi.ui.hw.waveshare7in5_HD import Waveshare7in5HD
|
||||
return Waveshare7in5HD(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare7in5_v2':
|
||||
from pwnagotchi.ui.hw.waveshare7in5_V2 import Waveshare7in5V2
|
||||
return Waveshare7in5V2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare7in5b_HD':
|
||||
from pwnagotchi.ui.hw.waveshare7in5b_HD import Waveshare7in5bHD
|
||||
return Waveshare7in5bHD(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare7in5b_v2':
|
||||
from pwnagotchi.ui.hw.waveshare7in5b_V2 import Waveshare7in5bV2
|
||||
return Waveshare7in5bV2(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare7in5bc':
|
||||
from pwnagotchi.ui.hw.waveshare7in5bc import Waveshare7in5bc
|
||||
return Waveshare7in5bc(config)
|
||||
|
||||
elif config['ui']['display']['type'] == 'waveshare13in3k':
|
||||
from pwnagotchi.ui.hw.waveshare13in3k import Waveshare13in3k
|
||||
return Waveshare13in3k(config)
|
||||
|
@ -33,7 +33,7 @@ class LcdHat(DisplayImpl):
|
||||
|
||||
def initialize(self):
|
||||
logging.info("initializing lcdhat display")
|
||||
from pwnagotchi.ui.hw.libs.waveshare.lcdhat.epd import EPD
|
||||
from pwnagotchi.ui.hw.libs.waveshare.lcd.lcdhat.epd import EPD
|
||||
self._display = EPD()
|
||||
self._display.init()
|
||||
self._display.clear()
|
||||
|
@ -93,6 +93,7 @@ ILI9341_GMCTRN1 = 0xE1
|
||||
|
||||
ILI9341_PWCTR6 = 0xFC
|
||||
|
||||
|
||||
class ILI9341(object):
|
||||
"""Representation of an ILI9341 TFT LCD."""
|
||||
|
||||
@ -349,7 +350,6 @@ class ILI9341(object):
|
||||
# Rotate the image
|
||||
pb = np.rot90(image, rotation // 90).astype('uint16')
|
||||
|
||||
|
||||
# Mask and shift the 888 RGB into 565 RGB
|
||||
red = (pb[..., [0]] & 0xf8) << 8
|
||||
green = (pb[..., [1]] & 0xfc) << 3
|
||||
|
@ -1,144 +1,164 @@
|
||||
FBIOGET_VSCREENINFO=0x4600
|
||||
FBIOPUT_VSCREENINFO=0x4601
|
||||
FBIOGET_FSCREENINFO=0x4602
|
||||
FBIOGETCMAP=0x4604
|
||||
FBIOPUTCMAP=0x4605
|
||||
FBIOPAN_DISPLAY=0x4606
|
||||
FBIOGET_VSCREENINFO = 0x4600
|
||||
FBIOPUT_VSCREENINFO = 0x4601
|
||||
FBIOGET_FSCREENINFO = 0x4602
|
||||
FBIOGETCMAP = 0x4604
|
||||
FBIOPUTCMAP = 0x4605
|
||||
FBIOPAN_DISPLAY = 0x4606
|
||||
|
||||
FBIOGET_CON2FBMAP=0x460F
|
||||
FBIOPUT_CON2FBMAP=0x4610
|
||||
FBIOBLANK=0x4611
|
||||
FBIO_ALLOC=0x4613
|
||||
FBIO_FREE=0x4614
|
||||
FBIOGET_GLYPH=0x4615
|
||||
FBIOGET_HWCINFO=0x4616
|
||||
FBIOPUT_MODEINFO=0x4617
|
||||
FBIOGET_DISPINFO=0x4618
|
||||
FBIOGET_CON2FBMAP = 0x460F
|
||||
FBIOPUT_CON2FBMAP = 0x4610
|
||||
FBIOBLANK = 0x4611
|
||||
FBIO_ALLOC = 0x4613
|
||||
FBIO_FREE = 0x4614
|
||||
FBIOGET_GLYPH = 0x4615
|
||||
FBIOGET_HWCINFO = 0x4616
|
||||
FBIOPUT_MODEINFO = 0x4617
|
||||
FBIOGET_DISPINFO = 0x4618
|
||||
|
||||
from mmap import mmap
|
||||
from fcntl import ioctl
|
||||
import struct
|
||||
|
||||
mm = None
|
||||
bpp, w, h = 0, 0, 0 # framebuffer bpp and size
|
||||
bpp, w, h = 0, 0, 0 # framebuffer bpp and size
|
||||
bytepp = 0
|
||||
vx, vy, vw, vh = 0, 0, 0, 0 #virtual window offset and size
|
||||
vx, vy, vw, vh = 0, 0, 0, 0 # virtual window offset and size
|
||||
vi, fi = None, None
|
||||
_fb_cmap = 'IIPPPP' # start, len, r, g, b, a
|
||||
_fb_cmap = 'IIPPPP' # start, len, r, g, b, a
|
||||
RGB = False
|
||||
_verbose = False
|
||||
msize_kb = 0
|
||||
|
||||
|
||||
def report_fb(i=0, layer=0):
|
||||
with open('/dev/fb'+str(i), 'r+b')as f:
|
||||
vi = ioctl(f, FBIOGET_VSCREENINFO, bytes(160))
|
||||
vi = list(struct.unpack('I'*40, vi))
|
||||
ffm = 'c'*16+'L'+'I'*4+'H'*3+'ILIIHHH'
|
||||
fic = struct.calcsize(ffm)
|
||||
fi = struct.unpack(ffm, ioctl(f, FBIOGET_FSCREENINFO, bytes(fic)))
|
||||
with open('/dev/fb' + str(i), 'r+b') as f:
|
||||
vi = ioctl(f, FBIOGET_VSCREENINFO, bytes(160))
|
||||
vi = list(struct.unpack('I' * 40, vi))
|
||||
ffm = 'c' * 16 + 'L' + 'I' * 4 + 'H' * 3 + 'ILIIHHH'
|
||||
fic = struct.calcsize(ffm)
|
||||
fi = struct.unpack(ffm, ioctl(f, FBIOGET_FSCREENINFO, bytes(fic)))
|
||||
|
||||
|
||||
def ready_fb(_bpp=None, i=0, layer=0, _win=None):
|
||||
global mm, bpp, w, h, vi, fi, RGB, msize_kb, vx, vy, vw, vh, bytepp
|
||||
if mm and bpp == _bpp: return mm, w, h, bpp
|
||||
with open('/dev/fb'+str(i), 'r+b')as f:
|
||||
vi = ioctl(f, FBIOGET_VSCREENINFO, bytes(160))
|
||||
vi = list(struct.unpack('I'*40, vi))
|
||||
bpp = vi[6]
|
||||
bytepp = bpp//8
|
||||
if _bpp:
|
||||
vi[6] = _bpp # 24 bit = BGR 888 mode
|
||||
try:
|
||||
vi = ioctl(f, FBIOPUT_VSCREENINFO, struct.pack('I'*40, *vi)) # fb_var_screeninfo
|
||||
vi = struct.unpack('I'*40,vi)
|
||||
global mm, bpp, w, h, vi, fi, RGB, msize_kb, vx, vy, vw, vh, bytepp
|
||||
if mm and bpp == _bpp:
|
||||
return mm, w, h, bpp
|
||||
with open('/dev/fb' + str(i), 'r+b') as f:
|
||||
vi = ioctl(f, FBIOGET_VSCREENINFO, bytes(160))
|
||||
vi = list(struct.unpack('I' * 40, vi))
|
||||
bpp = vi[6]
|
||||
bytepp = bpp//8
|
||||
except:
|
||||
pass
|
||||
|
||||
if vi[8] == 0 : RGB = True
|
||||
|
||||
ffm = 'c'*16+'L'+'I'*4+'H'*3+'ILIIHHH'
|
||||
fic = struct.calcsize(ffm)
|
||||
fi = struct.unpack(ffm, ioctl(f, FBIOGET_FSCREENINFO, bytes(fic)))
|
||||
msize = fi[17] # = w*h*bpp//8
|
||||
ll, start = fi[-7:-5]
|
||||
w, h = ll//bytepp, vi[1] # when screen is vertical, width becomes wrong. ll//3 is more accurate at such time.
|
||||
if _win and len(_win)==4: # virtual window settings
|
||||
vx, vy, vw, vh = _win
|
||||
if vw == 'w': vw = w
|
||||
if vh == 'h': vh = h
|
||||
vx, vy, vw, vh = map(int, (vx, vy, vw, vh))
|
||||
if vx>=w: vx = 0
|
||||
if vy>=h: vy = 0
|
||||
if vx>w: vw = w - vx
|
||||
else: vw -= vx
|
||||
if vy>h: vh = h - vy
|
||||
else: vh -= vy
|
||||
else:
|
||||
vx, vy, vw, vh = 0,0,w,h
|
||||
msize_kb = vw*vh*bytepp//1024 # more accurate FB memory size in kb
|
||||
bytepp = bpp // 8
|
||||
if _bpp:
|
||||
vi[6] = _bpp # 24 bit = BGR 888 mode
|
||||
try:
|
||||
vi = ioctl(f, FBIOPUT_VSCREENINFO, struct.pack('I' * 40, *vi)) # fb_var_screeninfo
|
||||
vi = struct.unpack('I' * 40, vi)
|
||||
bpp = vi[6]
|
||||
bytepp = bpp // 8
|
||||
except:
|
||||
pass
|
||||
|
||||
mm = mmap(f.fileno(), msize, offset=start)
|
||||
return mm, w, h, bpp#ll//(bpp//8), h
|
||||
if vi[8] == 0:
|
||||
RGB = True
|
||||
|
||||
ffm = 'c' * 16 + 'L' + 'I' * 4 + 'H' * 3 + 'ILIIHHH'
|
||||
fic = struct.calcsize(ffm)
|
||||
fi = struct.unpack(ffm, ioctl(f, FBIOGET_FSCREENINFO, bytes(fic)))
|
||||
msize = fi[17] # = w*h*bpp//8
|
||||
ll, start = fi[-7:-5]
|
||||
w, h = ll // bytepp, vi[1] # when screen is vertical, width becomes wrong. ll//3 is more accurate at such time.
|
||||
if _win and len(_win) == 4: # virtual window settings
|
||||
vx, vy, vw, vh = _win
|
||||
if vw == 'w':
|
||||
vw = w
|
||||
if vh == 'h':
|
||||
vh = h
|
||||
vx, vy, vw, vh = map(int, (vx, vy, vw, vh))
|
||||
if vx >= w:
|
||||
vx = 0
|
||||
if vy >= h:
|
||||
vy = 0
|
||||
if vx > w:
|
||||
vw = w - vx
|
||||
else:
|
||||
vw -= vx
|
||||
if vy > h:
|
||||
vh = h - vy
|
||||
else:
|
||||
vh -= vy
|
||||
else:
|
||||
vx, vy, vw, vh = 0, 0, w, h
|
||||
msize_kb = vw * vh * bytepp // 1024 # more accurate FB memory size in kb
|
||||
|
||||
mm = mmap(f.fileno(), msize, offset=start)
|
||||
return mm, w, h, bpp # ll//(bpp//8), h
|
||||
|
||||
|
||||
def fill_scr(r, g, b):
|
||||
if bpp == 32:
|
||||
seed = struct.pack('BBBB', b, g, r, 255)
|
||||
elif bpp == 24:
|
||||
seed = struct.pack('BBB', b, g, r)
|
||||
elif bpp == 16:
|
||||
seed = struct.pack('H', r >> 3 << 11 | g >> 2 << 5 | b >> 3)
|
||||
mm.seek(0)
|
||||
show_img(seed * vw * vh)
|
||||
|
||||
def fill_scr(r,g,b):
|
||||
if bpp == 32:
|
||||
seed = struct.pack('BBBB', b, g, r, 255)
|
||||
elif bpp == 24:
|
||||
seed = struct.pack('BBB', b, g, r)
|
||||
elif bpp == 16:
|
||||
seed = struct.pack('H', r>>3<<11 | g>>2<<5 | b>>3)
|
||||
mm.seek(0)
|
||||
show_img(seed * vw * vh)
|
||||
|
||||
def black_scr():
|
||||
fill_scr(0,0,0)
|
||||
fill_scr(0, 0, 0)
|
||||
|
||||
|
||||
def white_scr():
|
||||
fill_scr(255,255,255)
|
||||
fill_scr(255, 255, 255)
|
||||
|
||||
|
||||
def mmseekto(x, y):
|
||||
mm.seek((x + y * w) * bytepp)
|
||||
|
||||
def mmseekto(x,y):
|
||||
mm.seek((x + y*w) * bytepp)
|
||||
|
||||
def dot(x, y, r, g, b):
|
||||
mmseekto(x,y)
|
||||
mm.write(struct.pack('BBB',*((r,g,b) if RGB else (b,g,r))))
|
||||
mmseekto(x, y)
|
||||
mm.write(struct.pack('BBB', *((r, g, b) if RGB else (b, g, r))))
|
||||
|
||||
|
||||
def get_pixel(x, y):
|
||||
mmseekto(x, y)
|
||||
return mm.read(bytepp)
|
||||
|
||||
def get_pixel(x,y):
|
||||
mmseekto(x,y)
|
||||
return mm.read(bytepp)
|
||||
|
||||
def _888_to_565(bt):
|
||||
b = b''
|
||||
for i in range(0, len(bt),3):
|
||||
b += int.to_bytes(bt[i]>>3<<11|bt[i+1]>>2<<5|bt[i+2]>>3, 2, 'little')
|
||||
return b
|
||||
b = b''
|
||||
for i in range(0, len(bt), 3):
|
||||
b += int.to_bytes(bt[i] >> 3 << 11 | bt[i + 1] >> 2 << 5 | bt[i + 2] >> 3, 2, 'little')
|
||||
return b
|
||||
|
||||
|
||||
def numpy_888_565(bt):
|
||||
import numpy as np
|
||||
arr = np.fromstring(bt, dtype=np.uint32)
|
||||
return (((0xF80000 & arr)>>8)|((0xFC00 & arr)>>5)|((0xF8 & arr)>>3)).astype(np.uint16).tostring()
|
||||
import numpy as np
|
||||
arr = np.fromstring(bt, dtype=np.uint32)
|
||||
return (((0xF80000 & arr) >> 8) | ((0xFC00 & arr) >> 5) | ((0xF8 & arr) >> 3)).astype(np.uint16).tostring()
|
||||
|
||||
|
||||
def show_img(img):
|
||||
if not type(img) is bytes:
|
||||
if not RGB:
|
||||
if bpp == 24: # for RPI
|
||||
img = img.tobytes('raw', 'BGR')
|
||||
else:
|
||||
img = img.convert('RGBA').tobytes('raw', 'BGRA')
|
||||
if bpp == 16:
|
||||
img = numpy_888_565(img)
|
||||
else:
|
||||
if bpp == 24:
|
||||
img = img.tobytes()
|
||||
else:
|
||||
img = img.convert('RGBA').tobytes()
|
||||
if bpp == 16:
|
||||
img = numpy_888_565(img)
|
||||
from io import BytesIO
|
||||
b = BytesIO(img)
|
||||
s = vw*bytepp
|
||||
for y in range(vh): # virtual window drawing
|
||||
mmseekto(vx,vy+y)
|
||||
mm.write(b.read(s))
|
||||
|
||||
if not type(img) is bytes:
|
||||
if not RGB:
|
||||
if bpp == 24: # for RPI
|
||||
img = img.tobytes('raw', 'BGR')
|
||||
else:
|
||||
img = img.convert('RGBA').tobytes('raw', 'BGRA')
|
||||
if bpp == 16:
|
||||
img = numpy_888_565(img)
|
||||
else:
|
||||
if bpp == 24:
|
||||
img = img.tobytes()
|
||||
else:
|
||||
img = img.convert('RGBA').tobytes()
|
||||
if bpp == 16:
|
||||
img = numpy_888_565(img)
|
||||
from io import BytesIO
|
||||
b = BytesIO(img)
|
||||
s = vw * bytepp
|
||||
for y in range(vh): # virtual window drawing
|
||||
mmseekto(vx, vy + y)
|
||||
mm.write(b.read(s))
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 960
|
@ -29,7 +29,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 80
|
@ -80,7 +80,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 200
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 200
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 200
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 200
|
@ -27,7 +27,7 @@
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 152
|
@ -29,11 +29,9 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 168
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 122
|
@ -27,7 +27,7 @@
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
import RPi.GPIO as GPIO
|
||||
# import numpy as np
|
||||
|
@ -40,9 +40,8 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
from PIL import Image
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 104
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 122
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 122
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 122
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 104
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 122
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
from PIL import Image
|
||||
|
||||
# Display resolution
|
@ -29,9 +29,8 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
from PIL import Image
|
||||
import RPi.GPIO as GPIO
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 104
|
@ -29,11 +29,9 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 122
|
@ -29,11 +29,9 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 122
|
@ -29,11 +29,9 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 168
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 152
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 152
|
@ -29,11 +29,9 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 184
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 176
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 176
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 176
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 176
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 128
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 128
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 128
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 128
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 128
|
@ -30,9 +30,8 @@
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
from distutils.command.build_scripts import build_scripts
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 128
|
@ -29,11 +29,9 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
import PIL
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 168
|
@ -28,8 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from multiprocessing.reduction import recv_handle
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 240
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 280
|
@ -30,7 +30,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 640
|
@ -29,9 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from PIL import Image
|
||||
import RPi.GPIO as GPIO
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 400
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 800
|
@ -29,9 +29,7 @@
|
||||
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from PIL import Image
|
||||
import RPi.GPIO as GPIO
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 400
|
@ -28,7 +28,7 @@
|
||||
#
|
||||
|
||||
import logging
|
||||
from .. import epdconfig
|
||||
from pwnagotchi.ui.hw.libs.waveshare.epaper import epdconfig
|
||||
|
||||
# Display resolution
|
||||
EPD_WIDTH = 400
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user