Accessing "Persist" mode via the API?

Hi there! I’ve been enjoying using ChatGPT to help me code my own custom modes. One thing that has come up a few times is that ChatGPT tries to toggle persist mode in the code, only for us both to discover that it isn’t possible. Or maybe I’m missing something? Its also not listed in the API in the manual.

So would there be a way to access the persist mode? It would be nice to be able to toggle persist based on incoming audio or triggers.

Yes, the code below uses the eyesy.auto_clear boolean. As an example, it turns on the Persist function when the EYESY is receiving MIDI Note #60. The physical Persist button is functionally neutered here.

import pygame
import random

def setup(screen, eyesy):
    global xr, yr
    xr = eyesy.xres
    yr = eyesy.yres

def draw(screen, eyesy):
    global xr, yr
    
    pygame.draw.line(screen, (0,255,10), [0,0], [int(random.randrange(0,xr)),int(random.randrange(0,yr))], 2)
    
    eyesy.auto_clear = True
    if eyesy.midi_notes[60]:
        eyesy.auto_clear = False

The manual has been updated with this API item. Thanks for posting about it.

1 Like