How can I set the default script on my Adafruit Macropad?

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mdump
 
Posts: 7
Joined: Thu Feb 10, 2022 11:56 am

How can I set the default script on my Adafruit Macropad?

Post by mdump »

I'd like to set a specific script to load when launching my Adafruit Macropad. I wrote a script with no active buttons (in case I accidentally hit one) and a blank title (to stop burning the title of the current default into the screen). I've tried changing the script's name and the last save date with no effect. Any suggestions?

Thanks very much!

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: How can I set the default script on my Adafruit Macropad?

Post by dastels »

What do you mean by script? A C++ program or CircuitPython program? Talking about filenames and modification dates makes me thing it's CircuitPython.

What do you mean by "default"? You can have one program on the MacroPad at a time.

Dave

User avatar
mdump
 
Posts: 7
Joined: Thu Feb 10, 2022 11:56 am

Re: How can I set the default script on my Adafruit Macropad?

Post by mdump »

Hi, thanks for helping me clarify my question.
I use several CircuitPython programs on the Macropad (I called them "scripts").
When I power up the Macropad, it defaults to one of these programs - always the same one.
I'd like to change the default program to start when I power the device on.
I don't know how to do this.

Thanks again!

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: How can I set the default script on my Adafruit Macropad?

Post by dastels »

Can you post your code. I still don't have a good picture of what it's doing.

Dave

User avatar
mdump
 
Posts: 7
Joined: Thu Feb 10, 2022 11:56 am

Re: How can I set the default script on my Adafruit Macropad?

Post by mdump »

There are several hotkey .py programs I run on the Macropad under CircuitPython 7. They run fine. The problem I'd like solved is that when I plug the USB into the macropad, the first opening program is Ultraedit.py.

Once the macropad is on, I use the rotary knob to select other hotkey programs, such as Pause.py. When the macropad is first turned on by plugging in the USB, I'd rather the first program that shows is Pause.py, not Ultraedit.py.

I've attached the entire directory contents on the macropad. The macros I use are in the macros directory.

Thanks!

[/i][/i]
Attachments
Allfiles.zip
(131.87 KiB) Downloaded 5 times

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: How can I set the default script on my Adafruit Macropad?

Post by dastels »

OK, Ultraedit is the "default" because after apps is sorted it contains:

Code: Select all

['Ultraedit', 'gsheets', 'media', 'mouse', 'navigate', 'pause', 'tones']
and apps[0] is started initially. Renaming the one you want to be "default" to start with an uppercase and everything else start with a lowercase should do the job.

Dave

User avatar
blakebr
 
Posts: 942
Joined: Tue Apr 17, 2012 6:23 pm

Re: How can I set the default script on my Adafruit Macropad?

Post by blakebr »

Hi,

This is how I select what file.py is run at next boot. If you want you can test for grounded pin(s) to determine what program starts.

Bruce

Code: Select all

_ = 3

if   _ == 1:
    import Weather_code
elif _ == 2:
    import Scan_WiFi_code
elif _ == 3:
    import TFT_Colors_code
elif _ == 4:
    import Kattni_Rembor
elif _ == 5:
    import ansi_escape_code_simpletest
elif _ == 6:
    import ansi_escape_code__cursor_position_dev

User avatar
mdump
 
Posts: 7
Joined: Thu Feb 10, 2022 11:56 am

Re: How can I set the default script on my Adafruit Macropad?

Post by mdump »

Thank you all! The simple "rename to DEFAULT" worked perfectly.

Thanks again -

Charlie

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”