mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.39k stars 432 forks source link

rp2040-zero not correctly handled #2260

Open LeonHagenaarsKeus opened 2 years ago

LeonHagenaarsKeus commented 2 years ago

What were you trying to do?

Edit code on a WaveShare rp2040-zero running CircuitPython

What steps did you take to trigger the issue?

What did you expect to happen?

A working editor in CircuitPython mode on the waveshare rp2040-zero

What actually happened?

An editor working with a local folder (not the circuitpython device)

Operating System Version

Windows 11 21H2 build 22000.708

Mu Version

1.1.1

Other Info

Using version below as requested in https://github.com/mu-editor/crash-reports/issues/148: https://github.com/mu-editor/mu/actions/runs/2444128277

Editor Log

mu.log

carlosperate commented 2 years ago

Hi @LeonHagenaarsKeus,

Thanks for opening the separate GitHub issue.

How does your CircuitPython device mount itself in the operating system? Is the device name CIRCUITPY? What drive letter does it have? What build of CircuitPython is it running?

dhalbert commented 2 years ago

It looks like it was detected and then was lost five seconds later:

2022-06-07 12:51:39,497 - mu.interface.main:1072(show_confirmation) DEBUG: Detected new CircuitPython board device.
2022-06-07 12:51:39,497 - mu.interface.main:1073(show_confirmation) DEBUG: Would you like to change Mu to the CircuitPython mode?
2022-06-07 12:51:44,649 - mu.modes.base:61(get_default_workspace) INFO: Using workspace C:\Users\Leon Hagenaars-Keus\mu_code from settings file
2022-06-07 12:51:44,651 - mu.interface.main:1044(show_message) DEBUG: Could not find an attached CircuitPython device.
carlosperate commented 2 years ago

Without having a deep look I think the detection that asks the user to change the mode (via adafruit_board_toolkit using pyserial and USB data) is probably different than the detection that tries to configure Mu to save code into the CircuitPython MSD drive, which checks the volume name via Windows C apis.

LeonHagenaarsKeus commented 2 years ago

Hi @dhalbert

carlosperate commented 2 years ago
  • Device name: PIDOXL

Right, that'd be the reason. Mu expects the CircuitPython devices to have CIRCUITPY as the volume name.

I'm not too familiar with the general guidelines for making your own CircuitPython devices, is the current recommendation to change the drive volume name? Is it up to be board designer? or maybe there isn't any guidelines in this area?

LeonHagenaarsKeus commented 2 years ago

No, CircuitPython doesn't suggest this, KMK does suggest it in order to enable autodetection of split keyboards. Having different names also helps me detect which code is going to which side.

https://github.com/KMKfw/kmk_firmware/blob/master/docs/split_keyboards.md#ee-hands

The name out of the box was CIRCUITPY. Mu does detect the serial port, so I can use it for serial communication out of the box. Maybe being able to choose the device by hand (or putting a .mu file on the device) might be an option for those who want/need to change the name?

Perhaps detecting a code.py in the root of a drive might also be an option? (Installing CircuitPython will create a code.py file with 'hello-world'-like content)

LeonHagenaarsKeus commented 2 years ago

boot_out.txt is generated at each connect, this file does contain the string 'CircuitPython', so maybe it can be used for the same check?