Skip to content

PersephoneKarnstein/egirl-pwnagotchi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pwnagotchi e-girl

UPDATE!!

Friend Roodriiigooo actually implemented what I handwaved as "probably easy" and wrote an installation guide! Roodriiigooo you get the official UwU of appreciation

Background

At time of writing, the pwnagotchi only allows single line, text-based emoji to be used as faces for its moods. While these faces can be edited (by editing pwnagotchi/pwnagotchi/ui/faces.py), as written they can only be changed to different single-line emoji. The layout of the pwnagotchi's face is defined on line 57 of pwnagotchi/pwnagotchi/ui/view.py, using the Text class defined in pwnagotchi/pwnagotchi/ui/components.py,

class Text(Widget):
    def __init__(self, value="", position=(0, 0), font=None, color=0, wrap=False, max_length=0):
        super().__init__(position, color)
        self.value = value
        self.font = font
        self.wrap = wrap
        self.max_length = max_length
        self.wrapper = TextWrapper(width=self.max_length, replace_whitespace=False) if wrap else None

    def draw(self, canvas, drawer):
        if self.value is not None:
            if self.wrap:
                text = '\n'.join(self.wrapper.wrap(self.value))
            else:
                text = self.value
            drawer.text(self.xy, text, font=self.font, fill=self.color)

The same file also defines a Bitmap class which is never used, likely a holdover from work done towards fulfilling requests to make BMP faces a feature going as far back as 2019.

class Bitmap(Widget):
    def __init__(self, path, xy, color=0):
        super().__init__(xy, color)
        self.image = Image.open(path)

    def draw(self, canvas, drawer):
        canvas.paste(self.image, self.xy)

Because the pwnagotchi display is rendered on the fly1 we should be able to fairly simply replace the emoji defined in faces.py with custom images.

class View(object):
    def __init__(self, config, impl, state=None):
        global ROOT

        # setup faces from the configuration in case the user customized them
        faces.load_from_config(config['ui']['faces'])
        self._state = State(state={
            'face': Text(value=faces.SLEEP, position=self._layout['face'], color=BLACK, font=fonts.Huge),
            'status': Text(value=self._voice.default(),
                           position=self._layout['status']['pos'],
                           color=BLACK,
                           font=self._layout['status']['font'],
                           wrap=True,
                           # the current maximum number of characters per line, assuming each character is 6 pixels wide
                           max_length=self._layout['status']['max']),

Goal

The aim of this project is to replace the text pwnagotchi face with bitmap faces in the absence of an update that does same. The faces used are all custom drawn by me and fit within a 64x64px square. Some examples are shown below.

Emotion Original Replacement Emotion (cont'd) Original Replacement
LOOK_R ( ⚆_⚆) Look_R GRATEFUL (^‿‿^) Grateful
LOOK_L (☉_☉ ) Look_L EXCITED (ᵔ◡◡ᵔ) Excited
LOOK_R_HAPPY ( ◕‿◕) Look_R_Happy MOTIVATED (☼‿‿☼) Motivated
LOOK_L_HAPPY (◕‿◕ ) Look_L_Happy DEMOTIVATED (≖__≖) Bored
SLEEP
(long sleep)
(⇀‿‿↼) Sleep SMART
(on free channel)
(✜‿‿✜) Smart
SLEEP2
(short sleep)
(≖‿‿≖) Sleep2 LONELY (ب__ب) Lonely
AWAKE (◕‿‿◕) Awake SAD (╥☁╥ ) Sad
BORED (-__-) Bored ANGRY (-_-') Angry
INTENSE
(successful wifi association)
(°▃▃°) Avatar FRIEND (♥‿‿♥) Friend
COOL (⌐■_■) Cool BROKEN
(on reboot)
(☓‿‿☓) Broken
HAPPY (•‿‿•) Happy DEBUG
(on custom)
(#__#) Debug
UPLOAD [ /1/2]

Footnotes

  1. (I think, but the code there is annoying and I'd rather poke at it than spend an hour glaring at it keeping track of all the .super and shit)

About

64x64 px bmp faces for the pwnagotchi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published