summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-04-09 21:20:25 +0200
committerRaindropsSys <contact@minteck.org>2023-04-09 21:20:25 +0200
commite53077d514ef44e621a6b4cf20079ec46179ce5d (patch)
tree6afe8ce5922625ffecebdc6c982c26c27e84b999
parenta60a2d4f7388a596d855e999cb3bb848293db22b (diff)
downloadponybadge-e53077d514ef44e621a6b4cf20079ec46179ce5d.tar.gz
ponybadge-e53077d514ef44e621a6b4cf20079ec46179ce5d.tar.bz2
ponybadge-e53077d514ef44e621a6b4cf20079ec46179ce5d.zip
Updated 5 files, added 6 files and deleted 4 files (automated)
-rw-r--r--app.py30
-rw-r--r--archive/stealth2.jpegbin0 -> 12443 bytes
-rw-r--r--archive/stealth3.jpegbin0 -> 10165 bytes
-rw-r--r--archive/stealth4.jpegbin0 -> 11832 bytes
-rw-r--r--icons/discord.jpgbin2056 -> 0 bytes
-rw-r--r--icons/email.jpgbin2006 -> 0 bytes
-rw-r--r--icons/pronouns.jpgbin0 -> 453 bytes
-rw-r--r--icons/website.jpgbin0 -> 587 bytes
-rw-r--r--main.py10
-rw-r--r--qr.jpegbin4282 -> 0 bytes
-rw-r--r--rick.py27
-rw-r--r--state/fronter.txt2
-rw-r--r--state/stealth.txt2
-rw-r--r--stealth.py74
-rw-r--r--version.txt2
15 files changed, 102 insertions, 45 deletions
diff --git a/app.py b/app.py
index 9333911..738f7f9 100644
--- a/app.py
+++ b/app.py
@@ -5,6 +5,7 @@ import json
import sys
import uos as os
import machine
+import stealth as stealth_mode
global display
global badger
@@ -12,13 +13,12 @@ global badger
import config
def update(index):
+ badger.led(128)
display.set_pen(15)
display.clear()
if stealth:
- j = jpegdec.JPEG(display)
- j.open_file("stealth.jpeg")
- j.decode(0, 0, jpegdec.JPEG_SCALE_FULL, dither=False)
+ stealth_mode.stealth(badger, display)
else:
j = jpegdec.JPEG(display)
j.open_file("data/" + list[index]['id'] + ".jpeg")
@@ -43,6 +43,7 @@ def update(index):
f = open("state/stealth.txt", "w")
f.write("1" if stealth else "0")
f.close()
+ badger.led(0)
badger = badger2040w.Badger2040W()
@@ -58,6 +59,7 @@ except ValueError:
except ValueError:
pass
+badger.led(128)
display.set_pen(15)
display.clear()
@@ -87,8 +89,11 @@ display.update()
badger.set_update_speed(3)
update(current)
+badger.led(0)
while True:
+ machine.Pin(25, machine.Pin.OUT).value(1)
+
try:
badger2040w.system_speed(badger2040w.SYSTEM_SLOW)
except ValueError:
@@ -98,19 +103,26 @@ while True:
pass
if badger.pressed(badger2040w.BUTTON_C):
+ badger.led(128)
stealth = not stealth
update(current)
+ badger.led(0)
elif badger.pressed(badger2040w.BUTTON_DOWN):
+ badger.led(128)
if current < len(list) - 1:
current += 1
update(current)
+ badger.led(0)
elif badger.pressed(badger2040w.BUTTON_UP):
+ badger.led(128)
if current > 0:
current -= 1
update(current)
+ badger.led(0)
elif badger.pressed(badger2040w.BUTTON_A):
+ badger.led(128)
badger.set_update_speed(0)
display.set_pen(15)
@@ -124,14 +136,4 @@ while True:
update(current)
badger.set_update_speed(3)
- elif badger.pressed(badger2040w.BUTTON_B):
- ui.view(badger, display)
-
- badger.set_update_speed(1)
-
- display.set_pen(15)
- display.clear()
- display.update()
-
- badger.set_update_speed(3)
- update(current) \ No newline at end of file
+ badger.led(0) \ No newline at end of file
diff --git a/archive/stealth2.jpeg b/archive/stealth2.jpeg
new file mode 100644
index 0000000..828849b
--- /dev/null
+++ b/archive/stealth2.jpeg
Binary files differ
diff --git a/archive/stealth3.jpeg b/archive/stealth3.jpeg
new file mode 100644
index 0000000..a9b330c
--- /dev/null
+++ b/archive/stealth3.jpeg
Binary files differ
diff --git a/archive/stealth4.jpeg b/archive/stealth4.jpeg
new file mode 100644
index 0000000..1bafbce
--- /dev/null
+++ b/archive/stealth4.jpeg
Binary files differ
diff --git a/icons/discord.jpg b/icons/discord.jpg
deleted file mode 100644
index 01b1223..0000000
--- a/icons/discord.jpg
+++ /dev/null
Binary files differ
diff --git a/icons/email.jpg b/icons/email.jpg
deleted file mode 100644
index 898c5f4..0000000
--- a/icons/email.jpg
+++ /dev/null
Binary files differ
diff --git a/icons/pronouns.jpg b/icons/pronouns.jpg
new file mode 100644
index 0000000..e2176ea
--- /dev/null
+++ b/icons/pronouns.jpg
Binary files differ
diff --git a/icons/website.jpg b/icons/website.jpg
new file mode 100644
index 0000000..8a3c981
--- /dev/null
+++ b/icons/website.jpg
Binary files differ
diff --git a/main.py b/main.py
index 54bb4c1..cf965e0 100644
--- a/main.py
+++ b/main.py
@@ -1,2 +1,10 @@
#import rick
-import app \ No newline at end of file
+import app
+
+#import badger2040w
+#import picographics
+#badger = badger2040w.Badger2040W()
+#display = picographics.PicoGraphics(display=picographics.DISPLAY_INKY_PACK)
+
+#import stealth
+#stealth.stealth(badger, display) \ No newline at end of file
diff --git a/qr.jpeg b/qr.jpeg
deleted file mode 100644
index 916a02f..0000000
--- a/qr.jpeg
+++ /dev/null
Binary files differ
diff --git a/rick.py b/rick.py
deleted file mode 100644
index eda9cd3..0000000
--- a/rick.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import badger2040w
-import picographics
-import jpegdec
-import uos as os
-import time
-
-badger = badger2040w.Badger2040W()
-display = picographics.PicoGraphics(display=picographics.DISPLAY_INKY_PACK)
-
-display.set_pen(15)
-
-badger.set_update_speed(0)
-display.clear()
-display.update()
-
-badger.set_update_speed(3)
-display.clear()
-display.update()
-
-print(os.listdir("roll"))
-
-while True:
- for i in os.listdir("roll"):
- j = jpegdec.JPEG(display)
- j.open_file("roll/" + i)
- j.decode(0, 0, jpegdec.JPEG_SCALE_FULL)
- display.partial_update(0, 0, 128, 128)
diff --git a/state/fronter.txt b/state/fronter.txt
index 3f10ffe..25bf17f 100644
--- a/state/fronter.txt
+++ b/state/fronter.txt
@@ -1 +1 @@
-15 \ No newline at end of file
+18 \ No newline at end of file
diff --git a/state/stealth.txt b/state/stealth.txt
index 56a6051..573541a 100644
--- a/state/stealth.txt
+++ b/state/stealth.txt
@@ -1 +1 @@
-1 \ No newline at end of file
+0
diff --git a/stealth.py b/stealth.py
new file mode 100644
index 0000000..c411772
--- /dev/null
+++ b/stealth.py
@@ -0,0 +1,74 @@
+import json
+import jpegdec
+
+def stealth(badger, display):
+ # Loading config
+ file = open("./stealth.json", "r")
+ config = json.loads(file.read())
+ file.close()
+ print(config)
+
+ # Clearing screen
+ display.set_pen(15)
+ display.clear()
+
+ # Name rectangle (outer)
+ display.set_pen(0)
+ display.rectangle(128, 0, 296, 22)
+ display.set_pen(15)
+
+ # Name rectangle (name)
+ display.set_pen(15)
+ display.set_font("bitmap8")
+ display.text(config['nickname'], 140, 4, scale=2)
+
+ # Name rectangle (pronouns)
+ #display.set_pen(15)
+ #txt = config['pronouns'][0] + " | " + config['pronouns'][1]
+ #display.text(txt, 296 - (8 + (len(txt) * 9)), 4, scale=2)
+
+ # Separator lines
+ display.set_pen(0)
+ display.line(127, 0, 127, 128)
+ display.line(128, 103, 295, 103)
+ display.line(0, 0, 0, 128)
+ display.line(295, 0, 295, 128)
+ display.line(0, 0, 295, 0)
+ display.line(0, 127, 295, 127)
+
+ # Image
+ j = jpegdec.JPEG(display)
+ j.open_file("stealth.jpeg")
+ j.decode(1, 1, jpegdec.JPEG_SCALE_FULL, dither=True)
+
+ # Lines (real name)
+ j = jpegdec.JPEG(display)
+ j.open_file("icons/name.jpg")
+ j.decode(91 + 47, 20 + 4, jpegdec.JPEG_SCALE_FULL, dither=False)
+ display.set_pen(0)
+ display.set_font("bitmap8")
+ display.text(config['realname'], 119 + 47, 25 + 4, scale=2)
+
+ # Lines (pronouns)
+ j = jpegdec.JPEG(display)
+ j.open_file("icons/pronouns.jpg")
+ j.decode(91 + 47, 45 + 4, jpegdec.JPEG_SCALE_FULL, dither=False)
+ display.set_pen(0)
+ display.set_font("bitmap8")
+ display.text(config['pronouns'], 119 + 47, 50 + 4, scale=2)
+
+ # Lines (website)
+ j = jpegdec.JPEG(display)
+ j.open_file("icons/website.jpg")
+ j.decode(91 + 47, 70 + 4, jpegdec.JPEG_SCALE_FULL, dither=False)
+ display.set_pen(0)
+ display.set_font("bitmap8")
+ display.text(config['web'], 119 + 47, 75 + 4, scale=2)
+
+ # Quote
+ display.set_pen(0)
+ display.set_font("bitmap8")
+ display.text(config['quote'][0], 12 + 128, 107, scale=1)
+ display.text(" " + config['quote'][1], 12 + 128, 117, scale=1)
+
+ display.update() \ No newline at end of file
diff --git a/version.txt b/version.txt
index 415b19f..42f7d23 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-2.0 \ No newline at end of file
+2.1 \ No newline at end of file