Skip to content

Feature/m5stack cores3#1165

Closed
meganetaaan wants to merge 41 commits intoModdable-OpenSource:publicfrom
meganetaaan:feature/m5stack_cores3
Closed

Feature/m5stack cores3#1165
meganetaaan wants to merge 41 commits intoModdable-OpenSource:publicfrom
meganetaaan:feature/m5stack_cores3

Conversation

@meganetaaan
Copy link
Contributor

This PR is my first attempt to support for M5Stack CoreS3, the latest development board by M5Stack.

https://docs.m5stack.com/en/core/CoreS3

Available features:

  • LCD(ILI9341)
  • Touch screen(FT6336U)
    • Unlike the M5Stack Core2, the LCD of M5Stack CoreS3 does not have a "virtual button area" at the bottom. The touch-sensitive area is limited to a vertical range of 240 pixels. To maintain backward compatibility with Core2, an implementation has been added to consider the area from 200 to 240 pixels as virtual buttons. However, please note that this implementation may overlap with GUI elements like piu.
  • Power management (Axp2101)
  • Speaker

There are still many WIP:

  • Dual microphone
  • Camera
  • Proximity sensor
  • IMU
  • 8MB PSRAM

@phoddie
Copy link
Collaborator

phoddie commented Jun 25, 2023

Wow. Great progress on this!!

I don't have a CoreS3 yet to try this. Despite the work-in-progress status, do you think it is usable enough that we should merge it?

I fI understand correctly, the "virtual button area" is basically for compatibility with projects that expect the A B C buttons of earlier M5Stack products. One important project that requires the buttons is Stack-chan. Is it work making the compatibility behavior optional?

  • You could use config.virtualButton to enable it. Stack-chan can set that in the manifest.
  • If there are no virtual buttons, you could skip initializing the button global. That would give applications a way to check for button support at runtime.
  • You might allow config.virtualButton to have number values indicate the height of the virtual button area, so that projects can easily customize that if desired (or you could have another configuration for that).

They are initialized if `config.virtualButton` is truthy.
@meganetaaan
Copy link
Contributor Author

Yes, I would appreciate it if we could merge this in its current state. Here are my reasons:

  • I want to make the current program of Stack-chan work.
  • I want to allow other CoreS3 developers to easily try it out, encouraging further contributions.

I've made the virtual buttons opt-in. If config.virtualButton is truthy, the setup script will initialize the virtual buttons. I'm not sure how much demand there will be for fine-tuning the size and position of the buttons, so I'll add those options if there's demand from other developers. For now, I thought it best to keep the implementation simple with reasonable default values.

@phoddie
Copy link
Collaborator

phoddie commented Jun 27, 2023

I've made the virtual buttons opt-in. If config.virtualButton is truthy, the setup script will initialize the virtual buttons. I'm not sure how much demand there will be for fine-tuning the size and position of the buttons, so I'll add those options if there's demand from other developers. For now, I thought it best to keep the implementation simple with reasonable default values

@meganetaaan – Thank you for the quick change. That's all very reasonable.

Yes, I would appreciate it if we could merge this in its current state. Here are my reasons:

Makes sense. We'll get that merged. Note that we may be a little slow right now because of summer holidays, but we'll do our best.

@phoddie
Copy link
Collaborator

phoddie commented Jun 27, 2023

Merged. Good luck!

@phoddie phoddie closed this Jun 27, 2023
@kairos0ne
Copy link

@meganetaaan @phoddie Any chance we could get a minor update to the docs/ here for us who want to try/test and help but no clue how.

@phoddie
Copy link
Collaborator

phoddie commented Jul 3, 2023

Ah, it looks like @meganetaaan didn't update the esp32.md doc yet, probably because this is still in progress. The main thing to know is that the platform target for is esp32/m5stack_cores3. I don't have the device, but was able to build the helloworld example as follows:

cd $MODDABLE/examples/helloworld
mcconfig -d -m -p esp32/m5stack_cores3

From the commits, it looks like display, audio, touch, networking, BLE, etc should all be working from there so the built-in examples should apply. If you have specific questions, please ask.

@kairos0ne
Copy link

Ok scratch that post (deleted)...

I've reformatted the core3 and flashed many of the examples to it with success.

@kairos0ne
Copy link

If there anything else in particular you need tested for this?

@phoddie
Copy link
Collaborator

phoddie commented Jul 4, 2023

I've reformatted the core3 and flashed many of the examples to it with success

Excellent news!

If there anything else in particular you need tested for this?

@meganetaaan may have some ideas. Here are two areas that I thought of:

  1. As noted above, there is special touch support to emulate buttons M5Stack physical buttons. Did you happen to try any examples that use touch? A good example for that is piu/drag. If you are feeling ambitious, you might modify it to eliminate the border so you can test touch all the way to the bottom edge (which is where the M5Stack compatibility area is).
  2. There's also some complexity around audio. Did you try the piu/sound example?

@kairos0ne
Copy link

As noted above, there is special touch support to emulate buttons M5Stack physical buttons. Did you happen to try any examples that use touch? A good example for that is piu/drag. If you are feeling ambitious, you might modify it to eliminate the border so you can test touch all the way to the bottom edge (which is where the M5Stack compatibility area is).

I can report the example works well, I'll try the the border as recommended this evening. Although the drag drops if you move too quickly but I think thats down to the implementation of the example.

There's also some complexity around audio. Did you try the piu/sound example?

I can report the sound example works well.

I would love to see the mics implemented as this is core to the app I'm building... I read the notes above and if @meganetaaan you require any testing to help that process, let me know.

@phoddie
Copy link
Collaborator

phoddie commented Jul 5, 2023

@kairos0ne – thanks for the good news. And so quickly.

Although the drag drops if you move too quickly but I think thats down to the implementation of the example.

I wasn't able to reproduce this on a Moddable Two. In looking at the code, I would expect the drag to continue tracking until the driver reports there is no touch detected -- only onTouchEnded stops the tracking. Is it possible your finger sometimes crosses past the edge of the display / touch sensor? That would do it.

I would love to see the mics implemented as this is core to the app I'm building...

Me too! I have a project I'm trying to finish up that uses audio input. @meganetaaan – the Moddable team should have our M5Stack Core3 next week, so please let us know if we can assist in some way.

@kairos0ne
Copy link

@phoddie I double checked and back tested the core2 and they have similar behavior, it's not great for the drag and drop if you move fast it doesn't register the drag. I will look at the it and see if I can see what's causing it.

@kairos0ne
Copy link

I suspect the finger moves out off the hit area for the button before the onTouchMove function is called and the button looses focus. Not sure will look.

@kairos0ne
Copy link

I changed the touch count to 1 and things improved somewhat. Also removed the border as suggested: https://amnesia.io/937143469e0102395265d7b56b1123a88881dfb2c1502d84beb00e9dc5a2e884

@phoddie
Copy link
Collaborator

phoddie commented Jul 10, 2023

I changed the touch count to 1 and things improved somewhat.

@kairos0ne - Perhaps that's a hint. I wonder if sometimes when you are moving very quickly it is triggering a multitouch case? If that happens, the id argument to onTouchBegan, onTouchMoved, and/or onTouchEnded would be non-zero. The id should normally be zero for single touch cases. Could you add some tracing / debugging code to see if the id ever has a non-zero value?

@kairos0ne
Copy link

I'll have a dig with some debug code and see whats what... I'd like to have proper look at xsbug anyway and I have some time now, besides I need scroll for my menus for the game I'm building so would make sense for me to learn more in this area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants